sed script question

Brett Worth brettw at cray.com
Wed Feb 26 23:25:28 EST 2003


On Wed, 26 Feb 2003, Kim Holburn wrote:

> I have a sed script that takes this output:
> 
> test:/etc# ip link
> 1: lo: <LOOPBACK,UP> mtu 16436 qdisc noqueue 
>     link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00

...

> test:/etc# ./nics.sh 
> eth0:  00:10:18:01:bd:d5 
> eth1:  00:10:18:01:bd:d0 
> ext1:  00:06:5b:f3:09:5e 
> eth3:  00:06:5b:f3:09:5f 

> Can anyone show me how to add the commands ...

I know its not sed but just for fun:

ip link | awk ' $1 == "link/ether" { print i "  " $2 } { i = $2 } '

-- 
Brett



More information about the linux mailing list