T. Joseph CARTER wrote:
> On Tue, Feb 07, 2006 at 06:25:11PM -0800, Michael Miller wrote:
> > Ok I'll take it as long has you hand out Bob one as well.
>
> Yeah, Bob's got one coming too..
I am hurt! I would never waste valuable machine resources
running an expensive command like /bin/cat unnecessarily! (-:
Instead, I used cat to conCATenate files as input to wc. That's what
cat does. Not useless at all.
My command:
find . | xargs cat | wc -l
(BTW, it should have been "find . -type f | ..." Sorry.)
That prints a single number, the number of lines in all the
files in the tree.
If you take out the cat, it does something completely different.
find . -type f | xargs wc -l
If you have just a few files, it prints the number of lines in each,
and a total aftewards. But if you have more than can be passed to a
single command, wc will print a bunch of subtotals (which you'll never
see because they're lost in thousands of lines of other output) and no
grand total.
$ tar xfj glibc-2.3.6.tar.bz2
$ cd glibc*
$ find . -type f | xargs wc -l | grep total
252779 total
77668 total
127767 total
74484 total
68454 total
85387 total
304277 total
354790 total
723743 total
203993 total
Compare that to
$ find . -type f | xargs cat | wc -l
2273342
So the cat is needed.
--
Bob Miller K<bob>
[EMAIL PROTECTED]
_______________________________________________
EUGLUG mailing list
[email protected]
http://www.euglug.org/mailman/listinfo/euglug