Let's say I have a well-structured text file with following content(no leading line numbers):
1 Mon Jun 9 00:11:47 CST 2014
2 eth0 Link encap:Ethernet HWaddr D4:BE:D9:F5:5C:0E
3 inet addr:10.179.113.125 Bcast:10.179.113.127 Mask:255.255.255.248
4 inet6 addr: fe80::d6be:d9ff:fef5:5c0e/64 Scope:Link
5 UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
6 RX packets:1169385 errors:0 dropped:0 overruns:0 frame:0
7 TX packets:250825 errors:0 dropped:0 overruns:0 carrier:0
8 collisions:0 txqueuelen:10000
9 RX bytes:365792552 (348.8 MiB) TX bytes:20648578 (19.6 MiB)
10 Interrupt:24 Memory:d6000000-d6012100
11 Tue Jun 10 05:11:47 CST 2014
12 eth1 Link encap:Ethernet HWaddr D4:BE:D9:F5:5C:10
13 inet addr:10.254.4.1 Bcast:10.254.4.255 Mask:255.255.255.0
14 inet6 addr: fe80::d6be:d9ff:fef5:5c10/64 Scope:Link
15 UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
16 RX packets:3806158038 errors:0 dropped:23193484 overruns:0 frame:0
17 TX packets:1206000723 errors:0 dropped:0 overruns:0 carrier:0
18 collisions:0 txqueuelen:10000
19 RX bytes:1596108082 (1.4 GiB) TX bytes:2960952707 (2.7 GiB)
20 Interrupt:25 Memory:d8000000-d8012100
Now what I need is to filter out line#1, #3, #6 for the eth0 section and line #11, #13, #16 for the eth1 section with the grep keyword 'eth'.
Mon Jun 9 00:11:47 CST 2014
inet addr:10.179.113.125 Bcast:10.179.113.127 Mask:255.255.255.248
RX packets:1169385 errors:0 dropped:0 overruns:0 frame:0
Tue Jun 10 05:11:47 CST 2014
inet addr:10.254.4.1 Bcast:10.254.4.255 Mask:255.255.255.0
RX packets:3806158038 errors:0 dropped:23193484 overruns:0 frame:0
How can i make this?