Hi to the gurus & everyone
I need to extract some data, actually rows of data from a block of rows..how can I go about it. The block of rows can be something like the output of ifconfig as below.
Code:
eth0 Link encap:Ethernet HWaddr 00:0E:AB:01:16:60
inet addr:10.0.17.102 Bcast:10.127.255.255 Mask:255.128.0.0
inet6 addr: fe80::20e:abff:fe01:1660/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:59303561 errors:0 dropped:0 overruns:0 frame:0
TX packets:44876565 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:68665797 (65.4 Mb) TX bytes:18446744073532115470 (1759218604272.3 Mb)
Interrupt:16
eth1 Link encap:Ethernet HWaddr 00:0E:AB:01:16:61
inet addr:10.128.17.102 Mask:255.128.0.0
inet6 addr: fe80::20e:abff:fe01:1661/64 Scope:Link
UP RUNNING NOARP MTU:1500 Metric:1
RX packets:48517385 errors:0 dropped:0 overruns:0 frame:0
TX packets:44716078 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:5769058102 (5501.8 Mb) TX bytes:11973358297 (11418.6 Mb)
Interrupt:33
eth2 Link encap:Ethernet HWaddr 00:0E:AB:01:16:62
inet6 addr: fe80::20e:abff:fe01:1662/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:23591307 errors:0 dropped:0 overruns:0 frame:0
TX packets:378620 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:1813791668 (1729.7 Mb) TX bytes:62342217 (59.4 Mb)
Base address:0x2000 Memory:fea80000-feaa0000
Now if I need to extract the 1st and 4th row from each block so that the output can look something like.
eth0 Link encap:Ethernet HWaddr 00:0E:AB:01:16:60
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
eth1 Link encap:Ethernet HWaddr 00:0E:AB:01:16:61
UP RUNNING NOARP MTU:1500 Metric:1
eth2 Link encap:Ethernet HWaddr 00:0E:AB:01:16:62
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
How do I do it. Pls help
ricc