Using GZIP command


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Using GZIP command
# 1  
Old 11-21-2009
Using GZIP command

Hi All,

Is it possible to redirect the o/p of gzip command to another file?

I need to store the o/p in a separate file


Regards,
sh_kk
# 2  
Old 11-21-2009
for example, you need gzip a folder,

Code:
tar cvf - FOLDER_NAME |gzip > /PATH/Separete_file.tar.gz

# 3  
Old 11-21-2009
man gzip

Code:
...
gzip -c file1 file2 > foo.gz
...

# 4  
Old 11-21-2009
with GNU tar you can do:
Code:
tar zcvf files.tar.gz file1 file2

And of course you can put the stdout of the command in a separate file if that is what you mean
Code:
tar zcvf files.tar.gz file1 file2>files.out


Last edited by Scrutinizer; 11-21-2009 at 03:37 AM..
# 5  
Old 11-21-2009
Hi All,

Am getting following error while executing gzip:

/$HOME/A >> gzip > /$HOME/B


Getting error :
./shell: line 38: //home/XYZ/A: Permission denied

Permission are:

-rw------- 1 XYZ XYZ 15636480 Nov 21 03:31 A


Any idea why is this happening?
# 6  
Old 11-21-2009
You are trying to execute //home/XYZ/A and appending the output to the file gzip and then there are some more statements, but unfortunately //home/XYZ/A is not executable.
# 7  
Old 11-21-2009
Quote:
Originally Posted by Scrutinizer
You are trying to execute //home/XYZ/A and appending the output to the file gzip and then there are some more statements, but unfortunately //home/XYZ/A is not executable.
^^

Thank you for replying.

Here is what I am trying to do.

I have made a set of files and want to archive all of them.

1 > I pass all the files to PAX command and store the o/p in a file pax_x.

2 > Now, I need to pass this file pax_x to gzip and store that o/p in gzip_x instead of a .gz file.

I am not sure the use of tar command above.

Please help me out on this.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Printing the output of a gzip command intact

how can i get the printf command or the echo command to print the data that are inbetween the first and the last quotes? #!/bin/sh printf '%s\n' "^_<8b>^H^@U<8c>MX^@^Cí=ÙzÚH<97>×ð^Teìn<8c>Ób_<9d><9f>dXd<9b>^N^F7<82>8qâÎ'^K^Y^T<83>D<90>°M^Lý^Hó^Fs5w3ß|s5/ÐýbS%©<84>^DBH... (4 Replies)
Discussion started by: SkySmart
4 Replies

2. Shell Programming and Scripting

Exclude files in gzip command

hi, I would like to exlcude certain files which starts with AUS from a directory while gzip the files but i need it in gzip command only direct: AUS1.tx AUS2.txt NZ1.txt i want to gzip only NZ1.txt to NZ1.gz files starting with AUS should not be gzipped and i need it in gzip... (23 Replies)
Discussion started by: rohit_shinez
23 Replies

3. Shell Programming and Scripting

gzip

how to zip all log file in a folder expect the latest gzip * ---> will zip all log files but I don't want the latest file to be zipped ex: file1, file2, file3, file4, file5 any single command to gzip all files excpet file5 ? (2 Replies)
Discussion started by: rmann
2 Replies

4. Shell Programming and Scripting

find + tar + gzip + uunecode/email --> in one command?

How to search for all files with matching strings --> find + tar + gzip + uunecode/email them in one command? I am sure there is a right way to pass list of files to tar, then compress tar file. Then send that as attachment using uuencode in one command.. Can we do that!? (3 Replies)
Discussion started by: kchinnam
3 Replies

5. Shell Programming and Scripting

Help with GZIP

Hi Gurus, I have a requirement to zip a file using gzip and ftp it to target server. I am using a gzip script as below. gzip.sh #!/bin/ksh /usr/bin/gzip -9 $1 Filename for gzip.sh is passed by an application program. so the output for ./gzip.sh Test_YYYYMMDDHHMMSS.txt (file name is... (1 Reply)
Discussion started by: PRVARMA
1 Replies

6. UNIX for Advanced & Expert Users

gzip vs pipe gzip: produce different file size

Hi All, I have a random test file: test.txt, size: 146 $ ll test.txt $ 146 test.txt Take 1: $ cat test.txt | gzip > test.txt.gz $ ll test.txt.gz $ 124 test.txt.gz Take 2: $ gzip test.txt $ ll test.txt.gz $ 133 test.txt.gz As you can see, gzipping a file and piping into gzip... (1 Reply)
Discussion started by: hanfresco
1 Replies

7. Shell Programming and Scripting

gzip

Hi, I want to gzip files in loop. for i in `ls *.xml`; do gzip $i; done But i am gettin error like "/usr/bin/ls: Arg list too long" Also please tell me how to do it with while loop and also using find and then exec. (7 Replies)
Discussion started by: tushar_tus
7 Replies

8. UNIX for Advanced & Expert Users

Amoung tar and gzip whiich unix command is more practical with respect to space manag

Hi All Can any body help me out. Amoung tar and gzip whiich unix command is more practical with respect to space management and file restoration. Eg if I use tar or gzip which will be more helpful to reduce the space and during the file restoration. Please help me out. regards... (3 Replies)
Discussion started by: manas6
3 Replies

9. SCO

gzip

ciao a tutti, premesso che sono un principiante di unix, avrei bisogno di gzip/gunzip e SOPRATTUTTO delle istruzioni (ahimè dettagliatissime, come per un bimbo!) per installarlo... grazie mille, ciao (1 Reply)
Discussion started by: mfran2002
1 Replies

10. UNIX for Advanced & Expert Users

using gzip

Hi, I am trying to unzip a file that I unmounted onto a unix machine from a cd I had burned in a Windows machine. The file I am trying to unzip is a .tar file... it was originally a .tar.gz file because it was zipped using gzip. I have tried: % gzip -d hpux.tar (where hpux.tar is the file... (2 Replies)
Discussion started by: nattie_h
2 Replies
Login or Register to Ask a Question