I was going to write a bash script to pull out info I wanted from ifconfig -a
but then I saw this bash one liner:
/sbin/ifconfig | awk -v RS="\n\n" '{ for (i=1; i<=NF; i++) if ($i == "inet" && $(i+1) ~ /^addr:/) address = substr($(i+1), 6); if (address != "127.0.0.1") printf "%s\t%s\n", $1, address }'
Which produces output like:
eth1 10.91.5.189
eth2 10.101.3.96
I would like to strip more info out than this though... so I would like:
ethX MAC-add IP Bcast Mask
... how can I alter the above one liner to get the output I am after?