On Feb 8, 9:32 am, Icarus Sparry <i.sparry...@gmail.com> wrote: > On Tue, 08 Feb 2011 13:51:54 +0100, Petter Gustad wrote: > > Xah Lee <xah...@gmail.com> 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.
Nice. When was the + introduced? Xah -- http://mail.python.org/mailman/listinfo/python-list