grep Re: [Techtalk] real life kewl text-processing and regexps samples wanted

Telsa Gwynne hobbit at aloss.ukuu.org.uk
Sat Jan 10 13:14:34 EST 2004


On Fri, Jan 09, 2004 at 09:44:58PM -0800 or thereabouts, Akkana Peck wrote:
> Elena Bevell writes:
> > I like this recursive grep that I found somewhere:
> > find  . -type f -exec grep "thing-to-find" {} \;
>
> Here are my recursive grep aliases (for csh, bash syntax might require
> different characters escaped) with explanations:

These are really cool.

But one thing I haven't seen mentioned in all these grep tricks is
grep -r.

The output of grep --help on my (Fedora) box with grep-2.5.1 includes

Output control:
  -d, --directories=ACTION  how to handle directories
                            ACTION is 'read', 'recurse', or 'skip'
  -D, --devices=ACTION      how to handle devices, FIFOs and sockets
                            ACTION is 'read' or 'skip'
  -R, -r, --recursive       equivalent to --directories=recurse

..so I just do "grep -r thing-to-find".

Incidentally, -H will print the filename for each match.

Telsa



More information about the Techtalk mailing list