[ILUG] grep or awk

Fergal Daly fergal at esatclear.ie
Mon Sep 10 12:09:15 IST 2001


and as soon as I pressed send I realised that

sed 's/.*(\(.*\)).*\|.*/\1/'

will turn lines that don't have a matching pair of brackets into blanks,

Fergal


On Mon, Sep 10, 2001 at 11:57:25AM +0100, Fergal Daly wrote:
> sed 's/.*(\(.*\)).*/\1/'
> 
> will extract stuff from inside brackets but it'll leave lines with no
> brackets untouched
> 
> On Mon, Sep 10, 2001 at 11:40:09AM +0100, Patton, Tony wrote:
> > I am trying to get the ip address of a user that has logged in via
> > telnet.
> > I can get this information from the 'who -M' command, which gives me the
> > following :
> > 
> > 	xxxxxxx     ttyqb       Sep 10 11:33
> > (xxx.xxx.xxx.xxx)
> > 
> > what i want is to get the ip address from within the brackets.
> > 
> > any solutions?
> > 
> > using Compaq Tru64 btw.
> > 
> > -- 
> > Irish Linux Users' Group: ilug at linux.ie
> > http://www.linux.ie/mailman/listinfo/ilug for (un)subscription information.
> > List maintainer: listmaster at linux.ie
> 
> -- 
> 
> -- 
> Irish Linux Users' Group: ilug at linux.ie
> http://www.linux.ie/mailman/listinfo/ilug for (un)subscription information.
> List maintainer: listmaster at linux.ie

-- 




More information about the ILUG mailing list