Can anyone show me a simpler way:
John Dilley
jad at hpcndnm.cnd.hp.com
Tue Oct 16 06:40:39 AEST 1990
In article <40852 at eerie.acsu.Buffalo.EDU> cloos at acsu.buffalo.edu (James H. Cloos) writes:
>If anyone can show me a simpler way to do this (the simplest?) I'd be
>very appreciative:
>uncompress `du -a . | egrep .Z | awk '{print $2}' -`
This is probably the simplest and fastest (and safest):
$ find . -type f -name '*.Z' -print | xargs uncompress
or, if you don't have many files, this will work:
$ uncompress `find . -type f -name '*.Z' -print`
Note that your original scheme would have tried to uncompress a
directory named foo.Z -- given, that's not likely and would not have
been tragic. I'm just in the habit of writing production code ;-)
You could have also reduced your pipeline using this:
$ uncompress `ls -R | fgrep .Z`
The most important thing, IMHO, is losing the awk -- you pay a high
overhead for not doing much with it. Also, if you've got a system on
which egrep is faster than fgrep (ugh), don't use fgrep, as shown above.
My fgrep is actually aliased to the Boyer-Moore fast grep (a.k.a. bm).
Good luck to you in your massive uncompression ;-)
-- jad --
John Dilley
Hewlett-Packard
Colorado Networks Division
UX-mail: jad at cnd.hp.com
Phone: (303) 229-2787
--
This is not an official statement from Hewlett-Packard Corp., and does not
necessarily reflect the official position of HP. The information above is
provided in good faith but completely without warranty of any kind.
More information about the Comp.unix.questions
mailing list