Michael Lazin on 10 Oct 2008 13:53:54 -0700


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: [PLUG] egrep help


What I am doing is picking up the IP addresses, my problem seems to be finding a "||" immediately following the IP address.  What I tried seems to be picking up a | followed by a string and another | followed by a string.  What I am looking for is [IP address][||]

finding the 2 pipes in a row is what I am having trouble with.  Thanks for the info so far, this is helpful however. 

On Fri, Oct 10, 2008 at 4:46 PM, <skydiver38@comcast.net> wrote:
off the top of my head, so take this with a grain of salt...
 
You don't have anything for your "*"s to match.  IIRC, the "*" means "0 or more", but you don't tell it zero or more of *what*.  I'm not sure if egrep recognizes "\d" as meaning "numeric chars" or if you need to qualify a range of chars like "[0-9]".
 
And does egrep recognize "{1-3}" for specific numbers of items, or are you limited to "1 or more" type of qualifiers?
 
so something like "cat Developer*.csv | egrep [0-9]?\.[0-9]?\.[0-9]?\.[0-9]?\|\| | head" might work.  You may need to quote the regex.  Replace the "?"s with "{1-3}" if egrep recognizes that (my experience with regexes is with perl).
 
Good luck - someone more knowledgable will probably speak up soon.
 
 
-------------- Original message --------------
From: "Michael Lazin" <microlaser@gmail.com>
Hi, I'm trying to grep a CSV for an IP address followed by ||

I tried grep Developer *.csv | egrep \|*\.*\.*\.*\|\||head

but this is not working, it is picking up false positives, what I am looking for specifically is an IP address followed by || in the csv.  I am working on trying to teach myself regular expressions now but I am just in the beginning stages.  Any help would be appreciated. 

--
Michael Lazin
To gar auto estin noein te kai enai


---------- Forwarded message ----------
From: "Michael Lazin" <microlaser@gmail.com>
To: "Philadelphia Linux User's Group Discussion List" <plug@lists.phillylinux.org>
Date: Fri, 10 Oct 2008 20:21:37 +0000
Subject: [PLUG] egrep help
___________________________________________________________________________
Philadelphia Linux Users Group         --        http://www.phillylinux.org
Announcements - http://lists.phillylinux.org/mailman/listinfo/plug-announce
General Discussion  --   http://lists.phillylinux.org/mailman/listinfo/plug

___________________________________________________________________________
Philadelphia Linux Users Group         --        http://www.phillylinux.org
Announcements - http://lists.phillylinux.org/mailman/listinfo/plug-announce
General Discussion  --   http://lists.phillylinux.org/mailman/listinfo/plug




--
Michael Lazin
To gar auto estin noein te kai enai
___________________________________________________________________________
Philadelphia Linux Users Group         --        http://www.phillylinux.org
Announcements - http://lists.phillylinux.org/mailman/listinfo/plug-announce
General Discussion  --   http://lists.phillylinux.org/mailman/listinfo/plug