Re: Script help

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



<snip>
>
> People love to use very long pipelines. How about...
>
> ifconfig eth0 | awk -F. '/inet addr:/ {print $3}'

Or if the NIC is not necessarily eth0, but it's still the first one,
then the below will still work and will exclude any subsequent NICs
(you beat me to it, I was just testing things out before posting...).

ifconfig | awk -F . 'NR==1, /inet addr/ {printf $3}'

Jacques B.


[Index of Archives]     [Current Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]     [Fedora Docs]

  Powered by Linux