is there a way to achieve this with compress?


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting is there a way to achieve this with compress?
# 1  
Old 08-19-2006
Tools 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.
# 2  
Old 08-19-2006
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.
# 3  
Old 08-19-2006
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.
# 4  
Old 08-19-2006
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 Smilie

Last edited by nortypig; 08-19-2006 at 07:54 PM..
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to achieve UTF-8 encoding & URL escape in an xml file?

Is there any i can achieve entity escaping, URL escaping & UTF-8 encoded for the xml generated through shell script? #! /bin/bash echo "<path>" >> file.xml for x in `ls filename*` do echo -e "\t<dir>" >> file.xml echo -e "\t\t<file>$x</file>" >> file.xml... (0 Replies)
Discussion started by: vel4ever
0 Replies

2. UNIX for Advanced & Expert Users

how to achieve this output ?

in AIX ,HP Unix and in SUN solaris, how to find the logs by date and time, I mean , Logs which have been generated or updated most recently , which might be present in folders and sub folders, I need to get the list of these Logs along with location path. Example: ======== folder... (3 Replies)
Discussion started by: sidharthmellam
3 Replies

3. Shell Programming and Scripting

Is there a simpler way to achieve this?

Hi all I have the following which is part of a larger interactive script for adding virtual hosts to Apache's configuration (it was built for non-technical administrators). I'm curious as to whether there is a simpler way of achieving the same thing. All it does is look into the... (3 Replies)
Discussion started by: mlott
3 Replies

4. Shell Programming and Scripting

How to achieve Parellelism for the function which has multiple cp commands

Hi, Here is my requirement. Currently, there is a function which gets called in a for loop 2 times. doCopy() { cp /src/a*.jar /target/ cp /src/b*.jar /target/ cp /src/c*.jar /target } Since it is called sequentially from the for loop, I was asked to make parellel copy to... (7 Replies)
Discussion started by: kgsrinivas
7 Replies

5. UNIX for Dummies Questions & Answers

Issue: Compress in unix server and FTP to windows and open the compress file using Winzip

Hi All ! We have to compress a big data file in unix server and transfer it to windows and uncompress it using winzip in windows. I have used the utility ZIP like the below. zip -e <newfilename> df2_test_extract.dat but when I compress files greater than 4 gb using zip utility, it... (4 Replies)
Discussion started by: sakthifire
4 Replies

6. HP-UX

How to achieve Synchronization operation between two shells.

Hi all, I have a master shell which will be running in cron tab.It will pick the files from certain directory and call subshell (Child Shell).This subshell / Child Shell runs in the background. My problem is once if the master shell picks the file and passes it to subshell,it should go to... (6 Replies)
Discussion started by: cskumar
6 Replies

7. Shell Programming and Scripting

How to achieve this?

hi to all, i have the input(text file) like the below... Header 1,2,3 4,5,6 7,8,9 Footer i need a output(text file) like the below... Header,1,2,3,Footer Header,4,5,6,Footer Header,7,8,9,Footer please help me to find out? (2 Replies)
Discussion started by: aaha_naga
2 Replies

8. Programming

How to achieve Serialization in Unix C, C++

How to achieve SERIALIZATION in Unix , C, C++ Write Objects directly to disk and read back ? (1 Reply)
Discussion started by: Sivaswami
1 Replies

9. UNIX for Dummies Questions & Answers

Do i need a script to achieve this?

Hi all, i have a following folder call 'zz'. This 'zz' folder is found in the following directories. I would like to delete the zz in the following directories /aa/zz /aa/bb/cc/zz /aa/bb/cc/dd/zz /aa/bb/cc/dd/ee/zz and keep the zz folder in the following directories /WW/zz ... (1 Reply)
Discussion started by: new2ss
1 Replies

10. Shell Programming and Scripting

how to achieve following parallel processing thru unix

hey...... i hav the follwing scripts needs to run parallel, so i made it as follows, $HPath/start_script.sh 20 & $HPath/start_script.sh 03 & $HPath/start_script.sh 01 & $HPath/start_script.sh 12 & then once all these above got completed successfully i have to run ... (3 Replies)
Discussion started by: manas_ranjan
3 Replies
Login or Register to Ask a Question