Boston Linux & Unix (BLU) Home | Calendar | Mail Lists | List Archives | Desktop SIG | Hardware Hacking SIG
Wiki | Flickr | PicasaWeb | Video | Maps & Directions | Installfests | Keysignings
Linux Cafe | Meeting Notes | Blog | Linux Links | Bling | About BLU

BLU Discuss list archive


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Limits of grep?



On Tue, 26 Sep 2000, Subba Rao wrote:

> 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.

The problem is not that grep has a limit, but that the command line can
only have a certain number of characters... I think it's either 1k or 4k
but I don't remember.  

When you do something like

  grep 'a' *

the * gets expanded BY THE SHELL to the name of every file in the current
directory.  If that exceeds the maximum length of a command line, you
lose.

An alternate strategy might be to do something like:

  find . -exec grep 'a' {} \;

Also, at least with GNU grep, there's the --recursive option which will
let you grep a directory recursively... you might try that too.  Alternate
ways of specifying this are -r, and -d recurse, which may or may not be
available under commercial U*ixes.


-- 
Derek Martin
Senior System Administrator
Mission Critical Linux
martin at MissionCriticalLinux.com 

-
Subcription/unsubscription/info requests: send e-mail with
"subscribe", "unsubscribe", or "info" on the first line of the
message body to discuss-request at blu.org (Subject line is ignored).




BLU is a member of BostonUserGroups
BLU is a member of BostonUserGroups
We also thank MIT for the use of their facilities.

Valid HTML 4.01! Valid CSS!



Boston Linux & Unix / webmaster@blu.org