http://www.perlmonks.org?node_id=89615


in reply to Recursive Grep

That works nicely. Alternately:

find . -type f | grep -v CVS | xargs egrep

If you alias that to something (e.g. superfind) you can do:

superfind -i whatever

Of course the intermediate grep can be eliminated if you don't have standard things to ignore. Also you can replace the egrep with your favorite grep-like substitute. By having the egrep bare at the end you can pass whatever flags you want to it.

The advantage of the above is that it is probably faster, and I can remember & type it quickly when moving from machine to machine. The downside is that I don't have all of Perl's regex language (but egrep usually has all I need for this), it will not work on non-Unix boxes without additional packages, and that I can't customize it more as needed to control the exact matches. However, xargs is a cool and often overlooked tool.

-ben

Replies are listed 'Best First'.
Re: Knob Re: Recursive Grep
by John M. Dlugosz (Monsignor) on Jun 19, 2001 at 19:37 UTC
    There is a grep written in Perl, tcgrep, that supports all of Perl's regex by nature.