Pages

Thursday, May 2, 2013

Using multiple Field Separators in AWK

Most of the time working with awk we require multiple field separators, e.g. from the o/p of ifconfig you require ip address , BCast address as well netmask you can get all these details in one go as below

ifconfig eth0 | grep 'inet addr:' | awk -F '[: ]' '{print $13,$16,$19}' 

Here I am using the white space and colon both as field Separators 

No comments:

Post a Comment