Awk by Example
Here’s another example:
Here’s an excerpt of the output from this script:
As you can see, awk prints out the first and third fields of the /etc/passwd file, which happen to be the username and uid fields respectively. In this script, the field separator is specified within the code itself (by setting the FS variable), while our previous example set FS by passing the -F”:” option to awk on the command line. Normally, awk executes each block of your script’s code once for each input line.
Source: developer.ibm.com