Hi,
  
Changing system variables (like ARG_MAX) may well work, but often has
unknown side effects..

find . -type f -maxdepth 0 | xargs grep gsa  

 is the command you want.

Search the current directory, and report all entries of type file.

For each entry, set up one instance of grep to run.

====================================

find . -name gr\* -maxdepth 0 | xargs grep gsa

 will search all files in the current directory whose name begins with the 
letters gr.

==============================
You can also use the -exec option on find to do this, and do not need the
xargs option.


However, in my view, xargs is the more intuitively obvious method.

=================================

If you removed the maxdepth 0 option, it will traverse down the directory 
tree searching for all matching files.

Derek.

======================================================

On Wed, 3 Nov 2004, Matthew Gregan wrote:

> At 2004-11-03T12:59:04+1300, Nick Rout wrote:
> > [EMAIL PROTECTED] cur $ grep gsa *
> > -/bin/bash: /bin/grep: Argument list too long
> > [EMAIL PROTECTED] cur $ ls|wc
> >    4299    4299  339962
> 
> $ getconf ARG_MAX
> 131072
> 
> 339962 > ARG_MAX.
> 
> > on another box grep copes well with a directory of over 5000 files,
> > albeit with 5 character file names.
> 
> 25000 < ARG_MAX.
> 
> > so, whats the easiest way to do what i want?
> 
> The two Tims have anwswered this bit already.
> 
> > I'd also be interested to know whether this is to do with the number
> > of arguments, or the total number of characters in the argument list?
> 
> It's the total number of characters.  The limit (defined as ARG_MAX)
> differs between systems; the system I am typing this on has an ARG_MAX
> limit of 131072 and the OpenBSD box beside me has a limit of 262144.
> 
> Cheers,
> -mjg
> 

-- 
Derek Smithies Ph.D.                           This PC runs pine on linux for email
IndraNet Technologies Ltd.                     If you find a virus apparently from me, 
it has
Email: [EMAIL PROTECTED]                    forged  the e-mail headers on someone 
else's machine
ph +64 3 365 6485                              Please do not notify me when 
(apparently) receiving a
Web: http://www.indranet-technologies.com/     windows virus from me......


Reply via email to