9fans archive / 1998 / 09 / 15 /    prev next

From: Tom Duff td@pix...
Subject: [9fans] Find command
Date: Wed, 2 Sep 1998 14:02:34 -0700

On Sep 2,  4:28pm, Russ Cox wrote:
> fn xargs {
> 	while(a=`{read})
> 		$* $a
> }
>
> du -a | xargs ls -l

More straightforwardly, this is

	for(a in `{du -a}) ls -l $a

But, since du -a gives two fields on each line,
only one of which is interesting, you need to write

	for(a in `{du -a|awk '{print $2}'}) ls -l $a

or, since ls already loops over its arguments

	ls -l `{du -a|awk '{print $2}'}

-- 
Tom Duff.  It may be inelegant and sluglike, but bloatware sells.