I'm using ifconfig on OpenSUSE. When I run ifconfig eth0 I get
eth0 Link encap:Ethernet HWaddr CE:FD:75:DF:A5:6D
inet addr:172.16.4.177 Bcast:172.16.5.255 Mask:255.255.254.0
inet6 addr: fe80::adfd:75ef:fedf:v56d/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:11812456 errors:0 dropped:2 overruns:0 frame:0
TX packets:7000495 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:2591436376 (2471.3 Mb) TX bytes:9196901478 (8770.8 Mb)
I'm looking to format this so each parameter gets returned on a new line using sed or awk eg:
eth0
Link encap:Ethernet
HWaddr CE:FD:75:DF:A5:6D
inet addr:172.16.4.177
Bcast:172.16.5.255
Mask:255.255.254.0
inet6 addr: fe80::adfd:75ef:fedf:v56d/64
Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500
Metric:1
RX packets:11812456
errors:0
dropped:2
overruns:0
frame:0
TX packets:7000495
errors:0
dropped:0
overruns:0
carrier:0
collisions:0
txqueuelen:1000
RX bytes:2591436376 (2471.3 Mb)
TX bytes:9196901478 (8770.8 Mb)
I've tried ifconfig eth0 | sed 's/ /\r/' but that doens't seem to split on the double space.
Aucun commentaire:
Enregistrer un commentaire