On Fri, Jan 22, 2010 at 01:08:02PM -0500, Corey Thomasson wrote:
> On 1/22/2010 12:59 PM, Rudolf Sykora wrote:
> >Regardless of me having or not having encountered a problem,
> >building the whole list in advance is not really smart and will
> >lead to problems at some point for sure.
> >
> >Thanks
> >R
> >
> Assuming that's true, couldn't you do some kind of trick to break it
> up (mind you my syntax may be wrong, I don't use plan9 often)
> 
> for(i in a b c [and so on]) grep foo `{du -a . | awk '{print $2}' |
> grep ^$i}
> 
> If you're worried about the argument list being too long that would
> break it up into 26 separate greps with smaller arg lists I believe
> 

In linux there is the xargs command, which will read lines from stdin
and distribute them in chunks to the arguments of another command, as in

du -a . | awk '{print $2}' | xargs -n 10 grep foo

This will take every 10 lines of stdin and append them to "grep foo".
It's quite a useful command and seems to provide a unique function.  Is
there some equivalent of this in Plan 9?

Also, the title of this thread is a bit misleading. As far as I know,
find doesn't have the option to test for the contents of files, so even
with find you'd have to use xargs and grep.

Reply via email to