[wplug] need help with command

Bob Schmertz rschmertz at speakeasy.net
Thu Sep 11 17:11:45 EDT 2003


Jonathan S Billings incurred the wrath of Bob on Sep 11, by saying

>On Thu, 2003-09-11 at 16:54, Bob Schmertz wrote:
>> Jonathan S Billings incurred the wrath of Bob on Sep 11, by saying
>> 
>> >On Thu, 2003-09-11 at 13:53, Bob Schmertz wrote:
>> >
>> >> 
>> >> % find . -type f | xargs grep "*stuff*"
>> >
>> >This is an OK solution, until you get into situations where you have a
>> >densely populated directory tree, and you exceed the command-line length
>> >for a command (grep, in particular).  I've run into this problem myself.
>> 
>> The -n option should take care of this nicely.  For some of the other 
>> problems mentioned in other posts, however, sounds like xargs may not 
>> be the answer.
>
>Actually, no, it shouldn't because xargs is still getting a rather long
>list of arguments, the limit of which is defined by the shell.
>

While it's convenient to think of the process as taking the output from
the previous command and sticking it all at the end as arguments, that's
really not what it's doing.  xargs reads the "arguments" from standard
input, not from the shell command line.  Thus the shell plays no role
beyond what you typed on the command line, except possibly in the
execution of individual commands that xargs builds up.

-- 
Cheers,
Bob Schmertz





More information about the wplug mailing list