1

awk == with a variable

view story
linux-howto

http://www.unix.com – korn shell script on a Solaris 10 system Code: for NUM in 1234 1235; do cat <file> |awk -F\; '$7==$NUM {print $0}' ; done If the numbers 1234 or 1235 appear in the 7th column, print the line this works Code: for NUM in 1234 1235; do cat <file> |awk -F\; '$7==1234 {print $0}' ; done but when I try to put a variable in it doesn't like it. I have tried to protect my $NUM variable using ${NUM" or $"{NUM}" but no joy. any ideas? Moderator's Comments: (HowTos)