Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris

Re: Re: All files in dir to data

by knobunc (Pilgrim)
on May 14, 2001 at 18:00 UTC ( #80201=note: print w/replies, xml ) Need Help??

in reply to Re: All files in dir to data
in thread All files in dir to data

Or for people without rgrep:

find . -type f | xargs grep "whatever you want"

Which I alias (using bash) to:

alias superfind='find . -type f | xargs grep'
For that mod 1970's feel.


Replies are listed 'Best First'.
find and xargs and grep - add that /dev/null!
by merlyn (Sage) on May 14, 2001 at 18:02 UTC
    You won't get the filename prefix if xargs happens to hand grep only one item though. Always throw an extra /dev/null in there, which will be opened and bypassed, but is enough to ensure more than one filename at all times:
    find . -type f -print | xargs grep "whatever you want" /dev/null

    -- Randal L. Schwartz, Perl hacker

Re: Re: Re: All files in dir to data
by jepri (Parson) on May 14, 2001 at 18:16 UTC
    But to make sure you don't get screwed up by funny filenames, use:

    find . -type f -print0 | xargs -0r -iXX grep "word" XX

    I don't know how to work that into an alias though.

    I didn't believe in evil until I dated it.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://80201]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (5)
As of 2017-02-25 15:08 GMT
Find Nodes?
    Voting Booth?
    Before electricity was invented, what was the Electric Eel called?

    Results (365 votes). Check out past polls.