Subject: Re: Stopping wildcard expansion?
To: Richard Rauch <rkr@rkr.kcnet.com>
From: David Brownlee <abs@netbsd.org>
List: netbsd-users
Date: 01/11/2000 09:12:56
On Mon, 10 Jan 2000, Richard Rauch wrote:
> * Along similar lines, use xargs(1):
>
> find . | xargs -n 1 grep variable
>
> ...the pipe can be broken with ^C, as per usual.
>
> (The last (with -n 1) has the advantage of beginning grep operations ASAP,
> instead of trying to collect all of the filenames that it can, first.)
This does have a lot more overhead though, as you fire off
one grep for each file, plus you do not get the filename
of each file in the output.
You can try a variation with something like
find . | xargs -n 50 grep variable
but you still have a problem if the number of files % 50 is 1
I suppose the complete solution would be
(find . ; echo /dev/null ) | xargs -n 50 grep variable
(but now we are getting silly :)
David/absolute