Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'Use znew command in Terminal to recompress files' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Use znew command in Terminal to recompress files
Authored by: geohar on Apr 19, '04 11:39:02AM
link is broken: should be http://www.ugu.com

[ Reply to This | # ]
Use znew command in Terminal to recompress files
Authored by: jreades on Apr 19, '04 02:17:55PM
I did a quick test and you should be able to get away with the following:

uncompress -c foo.txt.Z | gzip -c > bar.txt.gz
Not quite so friendly as a command, but it get the job done quite nicely. Note that it will only work for single files. You might be able to handle multiple files using tar but I certainly wouldn't count on it. jon

[ Reply to This | # ]
ditto
Authored by: SeanAhern on Apr 19, '04 02:41:53PM
This script should do the trick:
#!/bin/sh
for file do
    uncompress -c $file | gzip -c > ${file%%.Z}.gz
done
Now, the actual znew script is also just a Bourne shell script, so this really isn't saying much. The real znew script has error recovery, testing of output files, changes to compression level, etc.

I include my script here merely to show that there's no magic here. It's actually a fairly simple formula.

[ Reply to This | # ]

ditto
Authored by: LC on Apr 19, '04 05:32:42PM
Bourne sh wouldn't do the pattern substitution though;
(but bash sh, ksh, zsh do do it)

gzip -dc $file | gzip -c > ${file%%.Z}.gz || echo "ERROR -- Couldn't make '${file%%.Z}.gz'"

[ Reply to This | # ]