[techtalk] Limits of grep?
Subba Rao
subb3 at attglobal.net
Sat Sep 30 06:45:20 EST 2000
On 0, Julie <jockgrrl at ix.netcom.com> wrote:
> From: Subba Rao <subb3 at attglobal.net>
> > 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, I get the error message somthing to the effect,
> >
> > "File argument list too long"
>
> You're exceeding the longest argument list which can be passed
> to a command via the exec() call. This is NCARGS_MAX.
>
> > What is the file argument limit for grep? I guess you need the grep source
> > for this. I did not find any information in the man page.
>
> Nope, this is a kernel limit.
>
> > Are there any other recommended tools to search through such large list of
> > files?
>
> find . -type f -print | xargs grep <pattern> /dev/null
>
Julie,
Thank you for replying. I tried the following solution and it works very fast.
find <path> -print | xargs -n 500 grep <pattern>
Using the "-type f" is a very good idea.
Thanks to everyone who replied with some solution!
--
Subba Rao
subb3 at attglobal.net
http://pws.prserv.net/truemax/
More information about the Techtalk
mailing list