xargs and grep!!!

pwharff

Registered
Ok, I have been studying UNIX for almost a year now. Right now I'm learning about 'xargs' and when I try the following command I get an error:

Code:
find . -type f -print | xargs grep -li epson

And I get this error:

Code:
xargs: unterminated quote

Please someone help as I am puzzled as why this doesn't work with Darwin UNIX but does on my Red Hat System.

--Paul
 
Thanks, it worked. Why do I need to include the -print0 AND -0 for this? Please explain. Thanks again in advance.
 
it works because it forces finds output to
be null terminated (\0) and xargs is being
told to use null terminated strings instead
of its normal WHITESPACE.

The spaces in the filenames are confusing
the defaults.

From the Fine Manual for xargs:

-0 Use NUL (``\0'') instead of whitespace as the argument sepa-
rator. This can be used in conjuction with the -print0
option of find(1).
 
Back
Top