The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
Google UNIX.COM


Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
How to achieve Synchronization operation between two shells. cskumar HP-UX 6 3 Weeks Ago 08:18 AM
Do i need a script to achieve this? new2ss UNIX for Dummies Questions & Answers 1 01-03-2008 03:07 AM
how to achieve following parallel processing thru unix manas_ranjan Shell Programming and Scripting 3 09-04-2007 04:54 AM
mv and compress on the fly simquest UNIX for Dummies Questions & Answers 1 02-22-2007 09:51 AM
tar and compress muru UNIX for Advanced & Expert Users 4 07-31-2006 05:23 PM

Reply
 
Submit Tools LinkBack Thread Tools Search this Thread Display Modes
  #1  
Old 08-19-2006
Registered User
 

Join Date: Aug 2006
Location: Hobart Tasmania
Posts: 58
Cool is there a way to achieve this with compress?

I'm trying to figure out how I can get an equivalent output to a text file such as if I use

gunzip -l filename

in that gunzip will output the previous file size and the compressed size and the ratio...

is there a way to achieve this with compress and zip?

i am very new at shell scripting and i seem to be getting documentation eyes but little result...

if anyone could offer a bit of quick advice I would greatly appreciate it, thanks.
Reply With Quote
Forum Sponsor
  #2  
Old 08-19-2006
Registered User
 

Join Date: Aug 2006
Location: Hobart Tasmania
Posts: 58
at the moment I have this piece of code...

gzip helpme
gunzip -l helpme > file
gunzip helpme
compress helpme
gunzip -l helpme >> file
gunzip helpme
zip helpme
zip helpme.zip helpme
gunzip -l helpme.zip >> file
gunzip helpme.zip


as you can see I am simply compressing and decompressing this helpme file three times - gzip, compress and zip - and am trying to get their respective before and after and compression percentage for comparison. I'll use awk later to display it.

So my question is really how do I get over the fact that gunzip -l outputs non gzip files as uncompressed -1 and ratio 0.0%?

If anyone could steer me on course with this I would greatly appreciate it. I'm determined to get on top of this and just have the feeling I'm missing something.
Reply With Quote
  #3  
Old 08-19-2006
...@...
 

Join Date: Feb 2004
Location: NM
Posts: 4,297
If you are trying to compress an already compressed file you don't gain much, in fact it is possible to lose - in the sense that the compressed compressed file is larger than the compressed file.

try gzip -9 <filename>

to get maximum compression.

If you are trying archive a bunch of files, tar them first, then compress the tarball. tar will allow you to archive .gz files.
Reply With Quote
  #4  
Old 08-19-2006
Registered User
 

Join Date: Aug 2006
Location: Hobart Tasmania
Posts: 58
sorry I must not have explained properly... all I am trying to do at this point is compress using 3 ways... zip, gzip and compress... and output the results into a file for comparison... which I will use awk to output the results sorted by best compression...

... a single file only

this is just an exercise and I'm not looking for code but rather general advice on how to go about it

thanks for the response anyway

Last edited by nortypig; 08-19-2006 at 03:54 PM.
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes




All times are GMT -7. The time now is 11:42 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0