Date: Mon, 09 Jun 2008 22:07:31 +0300 From: Giorgos Keramidas <keramida@ceid.upatras.gr> To: Ian Smith <smithi@nimnet.asn.au> Cc: Jos Chrispijn <jos@webrz.net>, Wojciech Puchar <wojtek@wojtek.tensor.gdynia.pl>, Bill Campbell <freebsd@celestial.com>, freebsd-questions@freebsd.org, Raphael Becker <rabe@uugrn.org> Subject: Re: Grep Guru Message-ID: <87y75efmvg.fsf@kobe.laptop> In-Reply-To: <Pine.BSF.3.96.1080610001213.15342A-100000@gaia.nimnet.asn.au> (Ian Smith's message of "Tue, 10 Jun 2008 01:44:36 %2B1000 (EST)") References: <Pine.BSF.3.96.1080610001213.15342A-100000@gaia.nimnet.asn.au>
next in thread | previous in thread | raw e-mail | index | archive | help
On Tue, 10 Jun 2008 01:44:36 +1000 (EST), Ian Smith <smithi@nimnet.asn.au> wrote:
>On Sun, 8 Jun 2008 16:07:12 -0700 Bill Campbell <freebsd@celestial.com> wrote:
>>On Mon, Jun 09, 2008, Raphael Becker wrote:
>>>On Sun, Jun 08, 2008 at 10:15:50PM +0200, Wojciech Puchar wrote:
>>>> find . -type f -print0|xargs -0 grep <grepoptions> <text to search>
>>>
>>> There's no more need for find | xargs
>>>
>>> Try:
>>>
>>> find . -type -f -exec grep <grepoptions> <text to search> {} \+
>>>
>>> -exec foo {} \+ behaves like xargs foo
>>> -exec foo {} \; exec foo for every file
>
> Thanks for this kick; I'd missed or misunderstood using {} \+
>
>> The issue here is that grep execs grep for each file found while
>> xargs batches the files.
>
> If find(1) is to be believed, so does -exec utility [argument ...] {} +
Yes, sure. I think Bill was just being extra-conservative[1] and he
explicitly chose to quote `+' with a backslash to avoid spurious
interpreration by the shell. I also type `\+' out of habbit most
of the time.
[1] BSD users tend to be this way, but that's a good thing, right? :)
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?87y75efmvg.fsf>
