[Subject Prev][Subject Next][Thread Prev][Thread Next][Subject Index][Thread Index]

Re: Limits of grep?



You can use either of:

    grep -r "pattern" .

or
    find . -type f | xargs grep "pattern" /dev/null

Regards,

-- Raju

>>>>> "Binand" == Binand Raj S <binand@xxxxxxxxxxxxxxxxxxxxx> writes:

    Binand> Subba Rao forced the electrons to say:
    >> 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.

    Binand> If your grep is GNU grep, then there is no limitation -
    Binand> except maybe a limit on the sizeof (int) on the
    Binand> architecture.

    Binand> The error is most likely from your shell, which seems to
    Binand> be enforcing some kind of bound to the argv[] array of the
    Binand> program it spawns. Is this on a Linux machine with shell
    Binand> as GNU Bash?

    >> Are there any other recommended tools to search through such
    >> large list of files?

    Binand> man find - but beware - it is going to be slow.

    Binand> Binand