Need help from the sed gods

Timothy Bauscher timothy at linuxfromscratch.org
Sun Sep 22 07:44:29 PDT 2002


On Sun, Sep 22, 2002 at 02:12:21PM +0200, Oliver Brakmann wrote:
> 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?

ifconfig eth0 | sed -ne '/inet/s/.*r://p' | sed -e 's/ .*//'

-- 
timothy(at)linuxfromscratch.org

-*- "Share and Enjoy" || "Go stick your head in a pig" -*-
-- 
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