Hi,
I wish to use a column, as inputted by a user from command line, for pattern matching.
awk file:
{
if($1 ~ /^8/)
{
print $0> "temp2.csv"
}
}
something like this, but i want '$1' to be any column as selected by the user from command line.
---------------------------
TRIED
{
if($ARGV[2] ~ /^8/)
{
print $0> "temp2.csv"
}
}
AND
{
if("'"$ARGV[2]"'" ~ /^8/)
{
print $0> "temp2.csv"
}
}
Neither works. They work for printing but do not help for pattern matching in 'if'.