AWK Examples


Tags:
                                  
extract second field separated by space (space is the default separator)
--------------------------------------
awk '{ print $2 }' 


extract second field separated by a tab
------------------------------------
awk -F'\t' '{ print $2 }' 


extract lines where second field is "TEST", separated by tab
---------------------------------------------------------
awk -F'\t' '($2=="TEST")'


extract second field where the third field is "TEST"
----------------------------------------------------
awk '($3=="TEST") { print $2 }'