awk - (Aho, Weinberger, Kernigan)

Example 1

Print the first and second fields in the /etc/passwd file
    $ awk -F: '{print $1, $2}' /etc/passwd

Example 2

Print all the lines that contain root and give a display a message beside it
    $ awk -F: '/root/ {print $1, "contains root"}' /etc/group

Example 3

Print all GIDs that are less than or equal to 4 and print the fields 1-4 of the /etc/group file
    $ awk -F: '$3<=4 {print $1, $2, $3, $4}' /etc/group

Example 4

Print a header line. Print the first field in the /etc/group file and then print a trailer line. When typing the following lines MAKE SURE YOU PUT A SPACE AT THE END OF EACH LINE BEFORE YOU HIT THE RETURN KEY!
    $ cat /etc/group | awk -F: \
      'BEGIN { print "This is the top"}
      {print $1}
      END {print "++++++++++++++++++++"}'