Mark writes:
> Programmers that don't utilize the full power of Unix suck. ;-)
>
> find /DEV/SOURCE | \
> xargs wc -l | \
> awk ' \
> $2 == "total" { total = total + $1} \
> END { print total}'
This works fine unless the user has a file named "total" on the system,
in which case you get the *wrong* answer, and no indication that it is
the wrong answer. Typical UNIX application :-)
Also you don't know how xargs is going to "batch up" the filenames. If
it ends up only passing one filename to wc at some point then you
don't get a 'total' line, and the result is *wrong* again.
> I like to describe Unix as a collection of tiny building blocks from
> which it is possible to build elegant skyscrapers (or disorganized
> shantytowns that defy building codes). You are only limited by your
> imagination, or your lack of knowledge of available Unix tools.
Where Microsoft operating systems are so complex that they are almost
impossible to use, UNIX is so simple that it's almost impossible to use.
G.