Linux Today: Linux News On Internet Time.
Search Linux Today
Linux News Sections:  Developer -  High Performance -  Infrastructure -  IT Management -  Security -  Storage -
Linux Today Navigation
LT Home
Contribute
Contribute
Link to Us
Linux Jobs


Top White Papers

More on LinuxToday


Exercise #7: Multiple Field Separators

Mar 09, 2011, 01:32 (0 Talkback[s])

"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

Related Stories: