[clue-tech] Too many words from ``

Lynn Danielson lynnd at techangle.com
Tue Jul 18 17:33:31 MDT 2000


matthew.w.mcillece at lmco.com wrote:
> 
> I occasionally need to search for every occurrence of a string in many (if
> not all) the files in a directory tree.  I can usually just do a
> 
> grep -ns string `find /path/to/tree -name "*" -print` | more
> 
> to get each line that the string occurs on, with the filename and line
> number and no complaints about files that can't be accessed.
> 
> However, sometimes I get the, "Too many words from ``" message and no other
> output.  I assume this message is generated by grep in response to a list of
> files that is bigger than it can handle.  Does anyone have a workaround for
> when this occurs?  Is there a way to make grep work with a bigger list of
> files?

This is what xargs is designed to handle.  Try your command this way:

find /path/to/tree | xargs grep -ns string /dev/null |less

Xargs parses up long argument lists into smaller chunks to avoid that
"too many words" message.  The /dev/null is not usually necessary, but
if you don't include it, it's possible that grep won't print the last
filename in your list even if "string is matched.

Lynn Danielson



More information about the clue-tech mailing list