How to use variable from bash to use in awk?

22 Jul 2014
If you want to use your variable from script inside awk, do the following

column=2
ps | awk '{print $var}' var=$column


or

name="Hello"
echo $name | awk '{print var}' var=$name



Comments