Seeking a grep-like script

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

 



Ahmed Kamal 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.

> Google says
> 
> #!/bin/sh
> 
> # usage: pargrep
> 
> inFile="$1"
> searchString="$2"
> 
> awk '
> BEGIN {
> FS="\n"
> RS=""
> }
> /'"$searchString"'/ { print }
> ' ${inFile}

Thanks.
And apologies for sending this query to the wrong newsgroup ...

-- 
Timothy Murphy  
e-mail: gayleard /at/ eircom.net
tel: +353-86-2336090, +353-1-2842366
s-mail: School of Mathematics, Trinity College, Dublin 2, Ireland



[Index of Archives]     [KDE Users]     [Fedora General Discussion]     [Older Fedora Users Mail]     [Fedora Advisory Board]     [Fedora Security]     [Fedora Maintainers]     [Fedora Devel Java]     [Fedora Legacy]     [Fedora Desktop]     [ATA RAID]     [Fedora Marketing]     [Fedora Mentors]     [Fedora Package Announce]     [Fedora Package Review]     [Fedora Music]     [Fedora Packaging]     [Centos]     [Fedora SELinux]     [Fedora Triage]     [Coolkey]     [Yum Users]     [Yosemite Forum]     [Fedora Art]     [Fedora Docs]     [Asterisk PBX]

  Powered by Linux