Arturo 'Buanzo' Busleiman schrieb:
> What about
>
> ip addr show dev eth0 | awk '{print $2}' | grep -v \: | head -n 1 | cut -d'/'
> -f1
IMO, too many different commands to be elegant...
Further:
[EMAIL PROTECTED] ~ $ ip addr show dev ra0
bash: ip: command not found
But if awk is okay, I'd do:
[EMAIL PROTECTED] ~ $ /sbin/ifconfig ra0 | sed -n 2p | sed -e '$!d' | awk -F:
'{print $2}' | sed 's| .*||'
192.168.1.11
Or if we make the assumption, that the network mask will
always start with "255.", we could do:
[EMAIL PROTECTED] ~ $ /sbin/ifconfig ra0 | awk -F: '/:255\./{print $2}' | sed
's| .*||'
192.168.1.11
Any awk "gurus" around? If so, how to do away with that sed command?
Alexander Skwar
--
[email protected] mailing list