LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Merge .gz without unzipping (https://www.linuxquestions.org/questions/linux-newbie-8/merge-gz-without-unzipping-4175559760/)

mayur.tesla@gmail.com 11-24-2015 08:53 AM

Merge .gz without unzipping
 
Is there any way to merge two or more .gz files without unzipping file?

jpollard 11-24-2015 11:53 AM

I don't think so. gzip requires everything to be present (chaining blocks I think) which causes an issue.

Thus appending another compressed file to the end of one would just confuse gzip - making a corrupted file.

John VV 11-24-2015 02:07 PM

Warning:
this site is crawled by bots !!!
the use of your EMAIL addres as a username is not a good idea

in fact it is a VERY BAD ONE
-- you will likely have to use a new address as that one is going to be SPAMED

Valery Reznic 11-25-2015 03:37 AM

Quote:

Originally Posted by mayur.tesla@gmail.com (Post 5454540)
Is there any way to merge two or more .gz files without unzipping file?

As long as I remember you can just
Code:

cat a.gz b.gz > c.gz
Then if you unzip c.gz then result will be concatenation of files 'a' and 'b'

Sure it's hold for .xz and .bz2 formats. About .gz you have to check.

By the way, why do you want do such a thing?

michaelk 11-25-2015 05:42 AM

Code:

cat a.gz b.gz > c.gz
This will not work for the reason given above. The gzip man page does have an example of merging files but not if they are already compressed.
Appending the files together should not corrupt them its just that the first does not have any clue the second exists. I do not know of way either.

pan64 11-25-2015 06:09 AM

just a comment, how it works? http://computerplumber.com/2014/03/m...iles-together/
And another solution:
http://stackoverflow.com/questions/2...mpressing-them

michaelk 11-25-2015 06:40 AM

I did finally find the posted links... I was wrong and my memory failed me again.

Hmm. cat does work.


All times are GMT -5. The time now is 04:00 PM.