Re: Seeking a grep-like script

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

 



On Thu, Jun 10, 2010 at 01:36:07PM +0100, 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.

perl -ne 'BEGIN { $/="" } print if /someword/' file1 file2 ... 

(setting $/ to the empty string makes perl read in whole paragraphs at a
time)

-- 
I don't want to achieve immortality through my work... I want to achieve
it through not dying.
    -- Woody Allen
-- 
users mailing list
users@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe or change subscription options:
https://admin.fedoraproject.org/mailman/listinfo/users
Guidelines: http://fedoraproject.org/wiki/Mailing_list_guidelines


[Index of Archives]     [Current Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]     [Fedora Docs]

  Powered by Linux