SED Help

Simon Tneoh Chee-Boon (Jaring Dialup) tneohcb at gen-x.com.my
Sun May 16 15:37:21 UTC 2004


How about the following with a space in front of SRC?
sed -re 's/.* SRC=([0-9]+\.[0-9]+\.[0-9]+\.[0-9]).*/\1/'

Regards,
Simon.
--
Simon Tneoh Chee-Boon     Gen-X Technology Sdn. Bhd.
http://www.gen-x.com.my    http://www.tneoh.zoneit.com/simon/


----- Original Message ----- 
From: "Mike Vanecek" <rh_list at mm-vanecek.cc>
To: "General Red Hat Linux discussion list" <redhat-list at redhat.com>
Sent: Sunday, May 16, 2004 10:27 PM
Subject: Re: SED Help

> > $ grep -i "`date '+%b %_d'`" packet.test2  | sed -re
> > 's/.*SRC=([0-9]+\.[0-9]+\.[0-9]+\.[0-9]).*/\1/'
> > 66.76.12.5
> > 66.76.12.5
> I thought it would pick up the first?  If I change the second SRC to SRX,
then
> it does pick up the first one.
>
> What do I need to specify to make it pick up the first one?






More information about the redhat-list mailing list