> From: "Thomas Joseph" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Subject: problem with grep 
> 
> Hi  All,
> 
> My system is RH7.1 on Intel.
> 
> When I do a grep on a directory that contains 12,000 plus
> files, (and no subdirectories)the system gives the following error:
> 
> bash:/bin/grep: Argument list too long
> 
> Could any of you please tell me what is the maximum 
> files that can be  in a directory for grep to work?
> 
> Is there a way to overcome this limitation ?
> 
> TIA
> 
> Thomas Joseph
> Spectrum Software Solutions.
> Liverpool, NY 13088
> 

This isn't a grep limitation, but an OS (kernel) limitation which allocates
a limited space to the argument lists.  I suspect you could use rgrep on
the DIRECTORY, unless you're on 7.2 which has lost rgrep (I don't remember
whether seawolf still has rgrep).  You could also probaby use 'grep -r' in
7.2.

The *CLASSIC* solution to this is to use 'find' and 'xargs'.  Something like
    find . -type f -print | xargs grep 'your_pattern_here'

--
        pete peterson
        Teradyne, Inc.
        7 Technology Park Drive
        Westford, MA 01886-0033

        [EMAIL PROTECTED] or [EMAIL PROTECTED]
        +1-978-589-7478 (Teradyne); +1-978-589-2088 (Closest FAX);
        +1-978-589-7007 (Main Teradyne Westford FAX)
 



_______________________________________________
Seawolf-list mailing list
[EMAIL PROTECTED]
https://listman.redhat.com/mailman/listinfo/seawolf-list

Reply via email to