Re: awk 2 variables from a single range?
From: Stephane CHAZELAS (this.address_at_is.invalid)
Date: 10/28/04
- Next message: Smith: "Check for special character"
- Previous message: AvidFan: "awk 2 variables from a single range?"
- In reply to: AvidFan: "awk 2 variables from a single range?"
- Next in thread: avidfan: "Re: awk 2 variables from a single range?"
- Reply: avidfan: "Re: awk 2 variables from a single range?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 28 Oct 2004 06:31:18 GMT
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
- Next message: Smith: "Check for special character"
- Previous message: AvidFan: "awk 2 variables from a single range?"
- In reply to: AvidFan: "awk 2 variables from a single range?"
- Next in thread: avidfan: "Re: awk 2 variables from a single range?"
- Reply: avidfan: "Re: awk 2 variables from a single range?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|