[clue-tech] Re: regex smarties - what am I doing wrong?

Patrick H. clue at feystorm.net
Wed Sep 3 15:36:52 MDT 2008


I think this is the sed you want
sed -e 's/\(\([[:digit:]]\{1,3\}\.\)\{3\}[[:digit:]]\{1,3\}\).*/\1/'


-------- Original Message  --------
Subject: Re: [clue-tech] Re: regex smarties - what am I doing wrong?
From: David L. Willson <DLWillson at TheGeek.NU>
To: mhavlicek1 at yahoo.com, CLUE tech <clue-tech at cluedenver.org>
Date: Wednesday, September 03, 2008 3:10:22 PM
> $ grep newwave hosts | sed -e 's/(([[:digit:]]{1,3}\.){3}[[:digit:]]{1,3})/\1/p'
> sed: -e expression #1, char 48: invalid reference \1 on `s' command's RHS
> ------------------------------
> Mike: Does escaping the open and closed parenths help?
> ------------------------------
> Surprise to me, yes, it does.  I don't get the error any more.  But I also don't get
> just the IP address, I get the whole line...  <mumble>
>
> What I'm trying to do is to grep a trashy list of names, nicknames, aliases, and IP
> addresses for (something), and in the case of a unique hit, return the IP address only,
> and an error of either "not found" or "not found uniquely" in the appropriate other cases.
>
> The first step, where I currently am stuck, is how to return only the IP address, rather
> than the whole line.  The rest should be a doddle. (remember Lemmings?)
>
> I'll keep trying and let you know if I figure it out.
> _______________________________________________
> clue-tech mailing list
> clue-tech at cluedenver.org
> http://www.cluedenver.org/mailman/listinfo/clue-tech
>   


-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://cluedenver.org/pipermail/clue-tech/attachments/20080903/219b6a26/attachment-0001.html


More information about the clue-tech mailing list