[wplug] need help with command

Bob Schmertz rschmertz at speakeasy.net
Thu Sep 11 13:53:30 EDT 2003


Mark Dalrymple incurred the wrath of Bob on Sep 11, by saying

>> I was man'n in the wrong place: find
>
>Find will work too, if you're on a platform that
>doesn't support grep -R.

I was going to type a similar response, only using the phrase "inferior 
versions of UNIX, such as Solaris" :-)

>
>% cd directory
>% find . -type f -exec grep "*stuff*" {} \; -print

Don't rememember if this was the list where there was a recent 
moderate-intensity flamewar over the use of -exec vs. xargs, so if it 
was, please accept my apologies for beating a dead horse:

Some people consider the use of the -exec option a bad idea in most 
cases, and prefer a usage such as the following:

% find . -type f | xargs grep "*stuff*"

the main reason I know of is that -exec forks a new process for every 
file that is found, and there's a bit of overhead involved in each fork, 
so it's slow and uses resources.

-- 
Cheers,
Bob Schmertz





More information about the wplug mailing list