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
Use "" - bash won't substitute single quotes.
Eg:
x=3 awk "\$2=$x{print \$1}" infile