Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 15 Feb 2011 11:30:39 -0500
From:      Lowell Gilbert <freebsd-questions-local@be-well.ilk.org>
To:        freebsd-questions@freebsd.org
Subject:   Re: script help
Message-ID:  <44mxlxuuog.fsf@be-well.ilk.org>
In-Reply-To: <7CD0B68CDB1B3698E9ABE60D@utd71538.local> (Paul Schmehl's message of "Tue, 15 Feb 2011 09:37:49 -0600")
References:  <3.0.1.32.20110214163437.019167e0@sage-american.com> <AANLkTinJn7=BMwCvRyEUoNQz-fR4%2BacHmiQovfuZ%2B69G@mail.gmail.com> <12e28896cd5.6574638108640039636.4001582758217268039@zoho.com> <AANLkTi=3ngyVR38-tCjcMKxOpNNSN6Qo2uiJE7y4qpDD@mail.gmail.com> <7CD0B68CDB1B3698E9ABE60D@utd71538.local>

next in thread | previous in thread | raw e-mail | index | archive | help
Paul Schmehl <pschmehl_lists@tx.rr.com> writes:

> --On February 15, 2011 12:57:12 PM +0300 Peter Andreev
> <andreev.peter@gmail.com> wrote:
>
>> Use of "xargs" on many files will be much faster than "find...exec"
>> construction
>>
>> find / -type f -name copyright.htm | xargs sed -i .bak -e 's/2010/2011/g'
>>
>
> I believe you, but can you explain why this is true?  What makes xargs
> faster than exec?

Classically, exec always spun off a new process for each exec (i.e.,
every single file).

For years now, find(1) has had a POSIX-standard syntax (ending the
command with a '+' syntax for the end of an -exec line, which does
pretty much the same thing in a single command.

Sometimes, the command being used only handles one filename at a time,
and -exec is necessary.



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