[ILUG] Limits of grep?
Subba Rao
subb3 at attglobal.net
Sat Sep 30 10:33:53 IST 2000
On 0, Fergal Daly <fergal at esatclear.ie> wrote:
> At 12:00 26/09/00, Paul Kelly wrote:
> >Subba Rao wrote:
> > > I have a directory of 10000+ text files and would like to search for
> > > some strings in these files. When I tried using "grep" command with an
> > > asterisk...
> >
> >That's a shell issue as much as grep. Try find . -print | xargs grep
> >"pattern"
>
> 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!
--
Subba Rao
subb3 at attglobal.net
http://pws.prserv.net/truemax/
More information about the ILUG
mailing list