---

Exercise #7: Multiple Field Separators

“Once you start creating awk scripts you will probably want to
use them on multiple files and as a result you will require
multiple field separators. Field separators are how awk determines
where the fields are. This can be a tricky business because it
results in a different output. In this example the if you were
searching for “nagios” in the /etc/group file and wanted to print
the first field you would get this result.

tail /etc/group
screen:x:84:
nscd:x:28:
pcap:x:77:
slocate:x:21:
sshd:x:74:
postdrop:x:90:
postfix:x:89:
nagios:x:500:
nagcmd:x:501:nagios
distcache:x:94:


Complete Story