Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 23 Sep 2004 18:00:48 -0400
From:      Richard Coleman <rcoleman@criticalmagic.com>
To:        John Baldwin <jhb@FreeBSD.org>
Cc:        David O'Brien <obrien@FreeBSD.org>
Subject:   Re: Could ARG_MAX be increased?
Message-ID:  <41534790.1000702@criticalmagic.com>
In-Reply-To: <200409231544.32001.jhb@FreeBSD.org>
References:  <b34be84204092304456066b0a0@mail.gmail.com> <b34be84204092312336001936a@mail.gmail.com> <20040923193720.GB10928@hub.freebsd.org> <200409231544.32001.jhb@FreeBSD.org>

next in thread | previous in thread | raw e-mail | index | archive | help
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@criticalmagic.com



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?41534790.1000702>