On 0, Fergal Daly <fergal at esatclear.ie> wrote:
> At 06:29 30/09/00, Subba Rao wrote:
> > > This will go wrong on any file that has a space or a shell meta character
> > > and may even end abruptly. To avoid this use
> > >
> > > find . -print0 | xargs -0 grep "pattern"
> > >
> > > find will output the filenames in null separated format and xargs will
> > > expect them like that,
> > >
> >
> >Thanks for replying. I tried the following solution and works much faster.
> >
> >find <path> -print | xargs -n 500 grep <pattern>
> >
> >Thanks to everyone who replied with a solution!
>> Does this work much faster than find <path> -print0 | xargs -0 -n 500 grep
> <pattern> ? The difference between them should be negligible,
>
Yes. It is negligible difference. It depends on the current state of the
process activity. With all things being equal the command sequence
$ find <path> -print0 | xargs -0 -n 500 grep <pattern>
performs better, but only with a few microseconds.
--
Subba Rao
subb3 at attglobal.nethttp://pws.prserv.net/truemax/
Maintained by the ILUG website team. The aim of Linux.ie is to
support and help commercial and private users of Linux in Ireland. You can
display ILUG news in your own webpages, read backend
information to find out how. Networking services kindly provided by HEAnet, server kindly donated by
Dell. Linux is a trademark of Linus Torvalds,
used with permission. No penguins were harmed in the production or maintenance
of this highly praised website. Looking for the
Indian Linux Users' Group? Try here. If you've read all this and aren't a lawyer: you should be!