Re: Could ARG_MAX be increased?

From: Richard Coleman <rcoleman_at_criticalmagic.com>
Date: Thu, 23 Sep 2004 18:00:48 -0400
John Baldwin wrote:
>>>> how about grep -r ou find | xargs grep !
>>> 
>>> How does that work, out of curiosity?
>>> 
>>> You can use the -exec feature of 'find' other wise -
>>> 
>>> find . -type f -exec grep "something" {} /dev/null \;
>> 
>> Using the '-exec' feature of 'find' fork+exec for *every* file
>> found. Using xargs reduces the number of fork+exec by the number of
>> filenames that fit on the command line.  So it runs much quicker.
> 
> 
> 'grep -r .' even quicker. :)
> 

I've been using the following for many moons.  It works on just about 
any unix box and is almost as fast.  I guess I got into the habit of 
using it since the grep on older boxes don't support any recursion.

find . -type f -print | xargs egrep -i REGEXP /dev/null

Richard Coleman
rcoleman_at_criticalmagic.com
Received on Thu Sep 23 2004 - 20:00:55 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:38:13 UTC