Linux.com

Correction to Correction

Posted by: Anonymous Coward on February 01, 2006 02:03 AM
Your version of ifconfig is different, or else you are using awk instead of gawk.

But anyway if you are going to trigger off<nobr> <wbr></nobr>/inet/ you don't need to clear the temp variable (iface=""), so do this:

ifconfig|awk -F'[<nobr> <wbr></nobr>:]+' '$1 {iface=$1};/inet/ {printf "%s:\t%s\n",iface,$4}'

see?

#

Return to CLI Magic: Learn to talk awk