Monday, June 11, 2012

awk command in linux

awk '/search pattern/ {action}
        /search partern/ {action}' file

awk '{print $2, $5;}' examp.txt
ps -ef | grep user | awk '{print "kill -9 " $2;}'
NF is a built in variable which represents total number of fields in a record


reference:
http://www.thegeekstuff.com/2010/01/awk-introduction-tutorial-7-awk-print-examples/

No comments:

Post a Comment