[OT] elegance?

Gerard Beekmans gerard at linuxfromscratch.org
Wed Jan 1 10:14:47 PST 2003


On January 1, 2003 11:04 am, Willem Oldeman wrote:
> Hi,
>
> To fetch the dynamically assigned IP address from my interface I use the
> following:
>
> ifconfig eth0 | grep "inet addr" | gawk -F" " '{ print $2 }' | gawk -F":"
> '{ print $2 }'
>
> Does any of you gurus know a more elegant solution for this?

not more elegant but an alternative to using gawk:

ifconfig eth0 | grep "inet addr"|cut -f 2 -d ":"|cut -f 1 -d " "

-- 
Gerard Beekmans
www.linuxfromscratch.org

-*- If Linux doesn't have the solution, you have the wrong problem -*-
-- 
Unsubscribe: send email to listar at linuxfromscratch.org
and put 'unsubscribe lfs-support' in the subject header of the message



More information about the lfs-support mailing list