Apr 17, 2007
AWK is your friend: Pretty Print Ethernet Info.
Posted by Shawn Holwegner under Interesting-Finds.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. :)
Previous Entry: Next Entry: Fixing Debian Etch broken Apache mod_authn_dbd; adding MySQL support Opting out of "Prescreened" credit offers online.