Why does using double quotes to enclose awk's action statements produce different results than when using single quotes to enclose them?
Solution 1:
If you use double quotes the $2
gets replaced by the shell before awk
is called. As $2
is usually empty running
awk {"print $2"}
is the same as running
awk {"print "}
Use
awk {"print \$2"}
if you want to use double quotes.