On Tue, 08 Feb 2011 13:51:54 +0100, Petter Gustad wrote:
> Xah Lee <[email protected]> writes:
>
>> problem with find xargs is that they spawn grep for each file, which
>> becomes too slow to be usable.
>
> find . -maxdepth 2 -name '*.html -print0 | xargs -0 grep whatever
>
> will call grep with a list of filenames given by find, only a single
> grep process will run.
>
> //Petter
This is getting off-topic for the listed newsgroups and into
comp.unix.shell (although the question was originally posed in a MS
windows context).
The 'modern' way to do this is
find . -maxdepth 2 -name '*.html' -exec grep whatever {} +
The key thing which makes this 'modern' is the '+' at the end of the
command, rather than '\;'. This causes find to execute the grep once per
group of files, rather than once per file.
--
http://mail.python.org/mailman/listinfo/python-list