当前位置: 技术问答>linux和unix
shell获取文件
来源: 互联网 发布时间:2017-04-28
本文导语: eth0 Link encap:Ethernet HWaddr 00:15:17:5E:5F:6C inet addr:192.168.0.33 Bcast:192.168.255.255 Mask:255.255.0.0 inet6 addr: fe80::215:17ff:fe5e:5f6c/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 ...
eth0 Link encap:Ethernet HWaddr 00:15:17:5E:5F:6C
inet addr:192.168.0.33 Bcast:192.168.255.255 Mask:255.255.0.0
inet6 addr: fe80::215:17ff:fe5e:5f6c/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:1144872507 errors:0 dropped:0 overruns:0 frame:0
TX packets:885101111 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:1136432969365 (1.0 TiB) TX bytes:656963257836 (611.8 GiB)
Memory:b8820000-b8840000
eth1 Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:1564202548 errors:0 dropped:0 overruns:0 frame:0
TX packets:1564202548 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:5000
RX bytes:1397446681227 (1.2 TiB) TX bytes:1397446681227 (1.2 TiB)
怎样使用sed实现提取eth0,txqueuelen:1000的数据组合成:eth0txqueuelen:1000
同样的组合成:eth1txqueuelen:5000。
|
ifconfig -a | sed ':a;$!N;s/n / /;ta;P;D' | sed -r 's/^([^ ]+).*(txqueuelen:[^ ]+).*/1 2/'