Re: awk 2 variables from a single range?
From: avidfan (none_at_swbell.net)
Date: 10/28/04
- Next message: K7MEM: "Re: generate HTML"
- Previous message: John L: "Re: Please optimize this pair of sed expressions for me"
- In reply to: Stephane CHAZELAS: "Re: awk 2 variables from a single range?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Thu, 28 Oct 2004 13:21:49 GMT
"Stephane CHAZELAS" <this.address@is.invalid> wrote in message
news:slrnco14hm.15o.stephane.chazelas@spam.is.invalid...
> 2004-10-28, 06:15(+00), AvidFan:
> > If, in ksh, I prompt the user for a range, in the format 1-255, and I
use
> > the read command to accept that as a single variable, how can I use awk
to
> > split that into 2 variables? I can't seem to figure out how to use a
> > variable as input for awk, so that it can split it into two variables...
> [...]
>
> Why would you want to use awk? read is the perfect tool for
> that:
>
> IFS=" -" read min max junk
>
> To use a variable as input for awk:
>
> awk 'BEGIN{print ARGV[1]; exit}' "$var"
>
> (use /usr/xpg4/bin/awk on Solaris).
>
> --
> Stephane
That works perfectly and with much less confusion. Thank you!
AvidFan
- Next message: K7MEM: "Re: generate HTML"
- Previous message: John L: "Re: Please optimize this pair of sed expressions for me"
- In reply to: Stephane CHAZELAS: "Re: awk 2 variables from a single range?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|