1826975 Members
3163 Online
109705 Solutions
New Discussion

scp and gunzip

 
SOLVED
Go to solution
Gilbert Standen_1
Frequent Advisor

scp and gunzip

Can a file be gunzip'd while it's being scp'd to another box ? The file is gzip'd on the source box and I want it to land unzip'd on the target box.
If I could take one thing with me into the next world it would be my valid login to HP ITRC Forums
7 REPLIES 7
Patrick Wallek
Honored Contributor

Re: scp and gunzip

I haven't tried this so I don't know if it'll work, but it might:

# gunzip < file.gz > - | scp - remotehost:/remote/dir/file
Steven E. Protter
Exalted Contributor
Solution

Re: scp and gunzip

I tested Patrick's idea.

Didn't work.

scp requires a source and a destination, so the concept can be modified to work.

gunzip filename.gz ; scp filename remotehostname://dir

That is teseted and works. Not exactly what you want.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Mauro Gatti
Valued Contributor

Re: scp and gunzip

I don't know if this is wath you want but You can try:

cd ; tar cvf - |compress|ssh "cd ;uncompress|tar xvf -"

Compress and uncompress seem to work fine with stadard input and output (like is written in man).


Rgds

Mauro
Ubi maior, minor cessat!
Laurent Menase
Honored Contributor

Re: scp and gunzip

gzip -c |ssh "cd ;gunzip -c >filename"

or
ssh "cd ;gunzip -c >filename"
Kari Pannila
Frequent Advisor

Re: scp and gunzip

You could instead of gunzip use the -C option of scp, if it works in your environment, you can forget gunzip.

scp options:

-C Compression enable. Passes the -C flag to ssh(1) to enable compression.
Kari Pannila
Kari Pannila
Frequent Advisor

Re: scp and gunzip

You must first of course unzip the file...
then scp -C...
Kari Pannila
Gilbert Standen_1
Frequent Advisor

Re: scp and gunzip

Laurent, your code works very well for my application so I have plugged that in where needed. It is very much appreciated. All the very excellent respones very much appreciated !!
If I could take one thing with me into the next world it would be my valid login to HP ITRC Forums