Could ARG_MAX be increased?

Richard Coleman rcoleman at criticalmagic.com
Thu Sep 23 15:00:55 PDT 2004


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


More information about the freebsd-current mailing list