On  0, bob at math.umn.edu wrote:
> Subba Rao allegedly wrote:
> > Hi
> > 
> > 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"
> > 
> > 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.
> > 
> > Are there any other recommended tools to search through such large list of
> > files?
> 
> You might try this:
> 
> ls -1 > filelist
> cat filelist | sed 's/^/grep a_string_of_importance /' > filelist
> chmod 700 filelist
> filelist
> 
> Yes, it makes a big file.  No, you will not need to worry about the dread
> "File argument list too long" message.  And finally, yes, there is probably
> a smarter way to do this.
> 

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 some solution!

-- 

Subba Rao
subb3 at attglobal.net
http://pws.prserv.net/truemax/

---------------------------------------------------------------------
To unsubscribe, e-mail: tclug-list-unsubscribe at mn-linux.org
For additional commands, e-mail: tclug-list-help at mn-linux.org