如何將以下輸出轉換爲sed? 來自:如何將ifconfig輸出連接到每個接口的線路
lo0: flags=2001000849<UP,LOOPBACK,RUNNING,MULTICAST,IPv4,VIRTUAL> mtu 8232 index 1
inet 127.0.0.1 netmask ff000000
igb0: flags=9040843<UP,BROADCAST,RUNNING,MULTICAST,DEPRECATED,IPv4,NOFAILOVER> mtu 1500 index 2
inet 10.1.1.1 netmask ffffff00 broadcast 10.1.1.255
groupname mnic_data
到:
lo0: flags=2001000849<UP,LOOPBACK,RUNNING,MULTICAST,IPv4,VIRTUAL> mtu 8232 index 1 inet 127.0.0.1 netmask ff000000
igb0: flags=9040843<UP,BROADCAST,RUNNING,MULTICAST,DEPRECATED,IPv4,NOFAILOVER> mtu 1500 index 2 inet 10.1.1.1 netmask ffffff00 broadcast 10.1.1.255 groupname mnic_data
我已經試過
sed -n '/^[a-z]/{x;1!s/\n/ /g;1!p;};H'
,但沒有運氣!預先感謝您的幫助
非常簡單。謝謝! – IdaWong