AWK is your friend: Pretty Print Ethernet Info.

This is incredibly simple, but it’s amazing how many people (ab)use Perl to do something that awk was designed for.

Here’s how to find your existing Linux styled ethernet interfaces:

%ifconfig -a | awk '(/inet\ addr/||/^eth/||/^lo/)&&!/127/ \
gsub(/inet\ addr:/, "") { print $1}'
eth0
10.10.0.212
eth1
85.92.154.212
eth1:1
192.168.30.1
lo
127.0.0.1

Those of you who might be able to read that will ask: Why not /127/? It’s a dummy test. :)