Description
Retrieve interface names and corresponding IPs from the output of /sbin/ifconfig.
Raw Input
eth0      Link encap:Ethernet  HWaddr 00:10:DC:D4:85:F9
          inet addr:10.1.1.2  Bcast:10.1.255.255  Mask:255.255.0.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:5641730 errors:0 dropped:0 overruns:0 frame:0
          TX packets:1030482 errors:0 dropped:0 overruns:0 carrier:0
          RX bytes:3709360243 (3537.5 Mb)  TX bytes:134133860 (127.9 Mb)
          Interrupt:11 Base address:0x3000
lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:4088 errors:0 dropped:0 overruns:0 frame:0
          TX packets:4088 errors:0 dropped:0 overruns:0 carrier:0
          RX bytes:539823 (527.1 Kb)  TX bytes:539823 (527.1 Kb)
Desired Output
eth0 10.1.1.2
lo 127.0.0.1
Script and Comments
Script1
[ 1] /^[^ ]/!d
[ 2] N
[ 3] s/^\([^ ]*\).*\n.*addr:\([^ ]*\).*/\1 \2/
Comments
  1. Step [1] will discard any line beginning with space(s) except those ones following a line beginning with interface names. Since these lines will be read via Step [2] rather than Step [1].