Path: utzoo!attcan!uunet!wuarchive!sdd.hp.com!hp-sdd!hpcndnm!jad From: jad@hpcndnm.cnd.hp.com (John Dilley) Newsgroups: comp.unix.questions Subject: Re: Can anyone show me a simpler way: Message-ID: Date: 15 Oct 90 20:40:39 GMT References: <40852@eerie.acsu.Buffalo.EDU> Sender: news@sdd.hp.com (Usenet News) Organization: Hewlett Packard, Colorado Networks Division Lines: 40 In-Reply-To: cloos@acsu.buffalo.edu's message of 15 Oct 90 22:21:45 GMT Nntp-Posting-Host: hpcndnm.cnd.hp.com In article <40852@eerie.acsu.Buffalo.EDU> cloos@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@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.