Need help from the sed gods

James Drabb JDrabb at tampabay.rr.com
Sun Sep 22 05:55:59 PDT 2002


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Sun, 22 Sep 2002 14:12:21 +0200
Oliver Brakmann <obrakmann at gmx.net> wrote:

> Hi group,
> 
> I need a little help:
> 
> I want to extract the IP address of a running network interface
> from the output of 'ifconfig $interface'.
> I get as far as 'ifconfig $interface | head -2 | tail -1 | sed ...'
> 
> Can anybody tell me which sed expression I have to use to get
> the IP address?
> 
> A big thanks in advance,
> Oliver
> -- 
> NP: Deftones - My own summer (Shove it)
> -- 
> Unsubscribe: send email to listar at linuxfromscratch.org
> and put 'unsubscribe lfs-chat' in the subject header of the message
> 

There are a many ways to do it : )

ifconfig eth0 | grep 'inet addr' | tr -s ' :' ' ' | gawk '{print $3}'

Jim Drabb
- -- 
- ----------------------
James Drabb, JR
Programmer Analyst
Davenport, FL
JDrabb at tampabay.rr.com
- ----------------------
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.7 (GNU/Linux)

iD8DBQE9jb3fMSVDgbMHT7ERAqWsAJ9N6gT43JuHUdlubmqct1fPndS9xQCfd4b9
bPQMMy3IVF929aQmPYfLJBo=
=T0rG
-----END PGP SIGNATURE-----
-- 
Unsubscribe: send email to listar at linuxfromscratch.org
and put 'unsubscribe lfs-chat' in the subject header of the message



More information about the lfs-chat mailing list