AWK question

heading rdkuphal at ihlpm.UUCP
Sat Aug 17 02:58:07 AEST 1985


> Does anyone know if and how I can get awk to do a >= (less than or equal)
> on a value entered from a terminal by the user?
> E.G.
> echo 'enter date in format yy-mm-dd \c $dt'
> read  dt
> echo $dt
> awk '$5  >= $dt ' .suspfile >xout
> 
> awk seems to ignore the terminal entered data. Is there any way to get
> awk to recognize this kind of variable?
> 
> ed daly
> ddaly at amc-hq

You just past the prompts reply into AWK as a parameter, as follows:

 echo 'enter date in format yy-mm-dd \c $dt'
 read  dt
 echo $dt
 awk '$5  >= $x ' x=$dt .suspfile >xout

The reference to x  may be just  x  instead of $x, I can't remember at
this time.  You may pass as many parameters as you desire, seperated with
white space <SP> .



More information about the Comp.unix mailing list