Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re: dgrep - Wrapper around gnu find & grep

by jmcnamara (Monsignor)
on Jul 22, 2002 at 21:08 UTC ( #184238=note: print w/replies, xml ) Need Help??


in reply to dgrep - Wrapper around gnu find & grep


I usually do something like this:     find . -name \*.pm | xargs grep foo

With egrep or grep -E as necessary. With gnu find the . isn't required. And with gnu grep you can also do the following (crude) recursive grep:     grep -rs foo *

There are probably other ways as well.

--
John.

Replies are listed 'Best First'.
Re^2: dgrep - Wrapper around gnu find & grep
by Aristotle (Chancellor) on Jul 22, 2002 at 22:17 UTC
    Lest filenames with spaces, newlines or other funky bits in them trip you, you might want to get into the habit of coupling find and xargs with their respective nullbyte-termination parameters (see manpages): find . -name \*.pm -print0 | xargs -0 grep foo
    ____________
    Makeshifts last the longest.
Re: Re: dgrep - Wrapper around gnu find & grep
by domm (Chaplain) on Jul 22, 2002 at 21:51 UTC
    Ah, this

    find . -name \*.pm | xargs grep foo

    is definitly nicer than what I was using.

    Thanks.

    (But I think I'll still use my wrapper...)

    -- #!/usr/bin/perl for(ref bless{},just'another'perl'hacker){s-:+-$"-g&&print$_.$/}

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://184238]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (9)
As of 2018-11-13 15:40 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My code is most likely broken because:
















    Results (156 votes). Check out past polls.

    Notices?