Seeking a grep-like script
Bill Davidsen
davidsen at tmr.com
Thu Jun 10 13:26:37 UTC 2010
Timothy Murphy wrote:
> I'm looking for a grep-like script that searches for a given word,
> and returns the paragraphs in which it appears (rather than the lines),
> where a paragraph is defined as the material between 2 blank lines.
>
> All suggestions gratefully received.
>
It would be relatively easy to do in perl, suggested logic is to read in a
paragraph, check for the word, print if found. Only takes a few lines of code.
If by "looking for" you mean finding a script which does you what you want, I
don't know where you find it, it's a bit trivial to bother to save.
Sample attached.
--
Bill Davidsen <davidsen at tmr.com>
"We have more to fear from the bungling of the incompetent than from
the machinations of the wicked." - from Slashdot
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pg-grep.pl
Type: application/x-perl
Size: 389 bytes
Desc: not available
Url : http://lists.fedoraproject.org/pipermail/users/attachments/20100610/40dd451f/attachment.bin
More information about the users
mailing list