AWK question

Paul Hoefling paulh at tektronix.UUCP
Sat Aug 10 08:52:32 AEST 1985


In article <435 at brl-tgr.ARPA> ddaly%xls-plexus01.amc at AMC-HQ.ARPA (DUSTY) writes:
>> 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?
>
> How about:
>
> awk '$5 >= "'"$dt"'"' .suspfile >xout
>
> this way the shell variable $dt get translated before awk gets it.

How about just:

awk "\$5 >= $dt" .suspfile >xout

-- 

Paul Hoefling
Information Pack Rat
uucp: {allegra,decvax,ihnp4,ucbvax,zehntel}!tektronix!paulh



More information about the Comp.unix.wizards mailing list