small help in linux script sed command
Hi Guys ,
i have a code that grap ipv6 address of the server
it seems like below :
ip addr show dev eth0 | sed -e's/^.*inet6 \([^ ]*\)\/.*$/\1/;t;d'
2001:19f0:5c00:9422:5400:ff:fe07:b80d
fe80::5400:ff:fe07:b80d
as we see the result is 2 lines , but what i need is i need only the 1st line with only the 1st 4 octects
i mean i need only
2001:19f0:5c00:9422
the question is , what other shell command can i do so that i get only the 2001:19f0:5c00:9422 only ?
cheers
|