Jeff Abrahamson on 15 Dec 2003 17:30:03 -0500


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

Re: [PLUG] grep with more structure and multi-line


Hey, that's pretty simple.

It almost does the right thing, probably useful for many of the
contexts where I want to do this.

It's not as useful if I don't know in which line of the three to
expect hits.  But often, as in the procmail example, I know in which
line I'm expecting hits.

Thanks.

(The general question is still open, out of curiosity, but I think
Tim handled over 90% of my need.)

-Jeff



On Mon, Dec 15, 2003 at 05:14:09PM -0500, Tim Cwik wrote:
>   [38 lines, 208 words, 1506 characters]  Top characters: e_tnoair
> 
> What about grep -A -B -C? Would that help?
> 
> 
> On 2003.12.15 17:04, Jeff Abrahamson wrote:
> > It happens often enough that I want to grep/awk/whatever files that
> > have multiline structure.  Today's example is a procmail log file.
> > Each record is three lines.  Here's an example record:
> > 
> > From plug-announce-admin@lists.phillylinux.org Mon Dec 15 15:31:11 2003
> >  Subject: plug-announce post from c5dfjjsqoq@lycos.it requires approval
> >   Folder: /usr/bin/lbdb-fetchaddr					
> >   3079
> > 
> > If I am searching for things from plug-announce-admin, then I would
> > want to see the entire three line record presented for each hit.
> > 
> > Of course, it's not too hard to write a little perl script to do this.
> > But it's not a one-liner, and so it's not as ad hoc as grep, awk, and
> > so forth on the command line.
> > 
> > Has anyone out there solved this problem so that such things can be
> > searched in a very ad hoc way?
> > 
> > --
> >  Jeff
> > 
> >  Jeff Abrahamson  <http://www.purple.com/jeff/>
> >  GPG fingerprint: 1A1A BA95 D082 A558 A276  63C6 16BF 8C4C 0D1D AE4B
> >
> 
> -- 
> Tim Cwik
> tcwik@stnhbr.com                            spamtrap: tjc123@stnhbr.com
> Voice: 609-368-2482                         Fax: 609-368-3695
> ___________________________________________________________________________
> 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

-- 
 Jeff

 Jeff Abrahamson  <http://www.purple.com/jeff/>
 GPG fingerprint: 1A1A BA95 D082 A558 A276  63C6 16BF 8C4C 0D1D AE4B

Attachment: pgpE3mzyIK0S5.pgp
Description: PGP signature