On Sat, Nov 08, 2003 at 06:54:58AM -0000, Marc Henry Galang wrote: > hmm... you're having that kind of error too? Whats your condition when > that message was outputed? im having that one too, its really annoying, > even when you remove some of the files to be greped it still outputs that > message. >
This is a limitation of the shell, a limitation that seems to have existed in the earliest days of Unix that the authors of the Bourne Again Shell have not seen fit to fix (seems strange because a lot of the internal limitations of many of the original POSIX commands have disappeared in the GNU versions of the same). There's an absolute limit of 5000 or so characters in the length of any command line, which is why you get the 'argument list too long' error message, which is not generated by grep but by the shell. This is not limited to grep, any command at all has this same problem, when you want it to deal with more than a certain number of files, or several files with abnormally long lines. I once ran into this mess when a misconfigured logrotate created close to a hundred thousand tiny files and exhausted inode space before we figured out what was going on. The most convenient workaround for this 5000-character limit I've been able to find was the xargs(1) command, which you could use as follows: find . -name "*" -print | xargs "grep pattern" The find command will list all of your files, and piping it through xargs will cause xargs to run grep once for every file it finds. -- Philippine Linux Users' Group (PLUG) Mailing List [EMAIL PROTECTED] (#PLUG @ irc.free.net.ph) Official Website: http://plug.linux.org.ph Searchable Archives: http://marc.free.net.ph . To leave, go to http://lists.q-linux.com/mailman/listinfo/plug . Are you a Linux newbie? To join the newbie list, go to http://lists.q-linux.com/mailman/listinfo/ph-linux-newbie
