Quote:
Originally Posted by freakygs
it worked but the grep command ran for multiple times, ...
|
xargs can/will do that. Think of running something like 'find . -type f -exec grep foo {}\;' - that will exec 'grep' once for each file found. Now, running 'find . -type f | xargs grep foo' will minimize the number of time grep is called. It still may need to be called more than once, since there is a limit to the length of a command line, depending on your shell and architecture - for example, mine is roughly 32k. If I ran a huge search on a large source branch, I'd expect to search well over 32k files, so even in the best case scenario, xargs could not possibly build the "ideal" command line for me.