Hi,
Is there a way to use nawk or grep to search a column in a data file when the column number and search string are input by the user? In other words, in this example I am searching the second column for the word Orient:
nawk '$2 ~ /Orient/ {print $0}' acmebooks
But what I'd like to do is use a variable instead of $2, and use a variable instead of Orient.
Thanks!
Ree
Is there a way to use nawk or grep to search a column in a data file when the column number and search string are input by the user? In other words, in this example I am searching the second column for the word Orient:
nawk '$2 ~ /Orient/ {print $0}' acmebooks
But what I'd like to do is use a variable instead of $2, and use a variable instead of Orient.
Thanks!
Ree