I have a script, in which a script snippet is:
x=3 awk \'$2=$x{print $1}\' infile
The external variable is x,
x
but it p
GAWK also supports the following syntax:
awk '$2 == x {print $1}' x=3 infile
An interesting usage is:
awk '$2 == x {print $1}' x=3 infile1 x=10 infile2
in this case x will be equal to 3 for infile1 and equal to 10 for infile2
3
infile1
10
infile2