LinuxQuestions.org
Latest LQ Deal: Linux Power User Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 11-24-2015, 08:53 AM   #1
mayur.tesla@gmail.com
LQ Newbie
 
Registered: Nov 2015
Location: India
Posts: 1

Rep: Reputation: Disabled
Merge .gz without unzipping


Is there any way to merge two or more .gz files without unzipping file?
 
Old 11-24-2015, 11:53 AM   #2
jpollard
Senior Member
 
Registered: Dec 2012
Location: Washington DC area
Distribution: Fedora, CentOS, Slackware
Posts: 4,696

Rep: Reputation: 1261Reputation: 1261Reputation: 1261Reputation: 1261Reputation: 1261Reputation: 1261Reputation: 1261Reputation: 1261Reputation: 1261
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.
 
Old 11-24-2015, 02:07 PM   #3
John VV
LQ Muse
 
Registered: Aug 2005
Location: A2 area Mi.
Posts: 17,093

Rep: Reputation: 2474Reputation: 2474Reputation: 2474Reputation: 2474Reputation: 2474Reputation: 2474Reputation: 2474Reputation: 2474Reputation: 2474Reputation: 2474Reputation: 2474
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
 
Old 11-25-2015, 03:37 AM   #4
Valery Reznic
ELF Statifier author
 
Registered: Oct 2007
Posts: 676

Rep: Reputation: 136Reputation: 136
Quote:
Originally Posted by mayur.tesla@gmail.com View Post
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?
 
Old 11-25-2015, 05:42 AM   #5
michaelk
Moderator
 
Registered: Aug 2002
Posts: 15,808

Rep: Reputation: 1784Reputation: 1784Reputation: 1784Reputation: 1784Reputation: 1784Reputation: 1784Reputation: 1784Reputation: 1784Reputation: 1784Reputation: 1784Reputation: 1784
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.
 
Old 11-25-2015, 06:09 AM   #6
pan64
LQ Guru
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 9,339

Rep: Reputation: 2747Reputation: 2747Reputation: 2747Reputation: 2747Reputation: 2747Reputation: 2747Reputation: 2747Reputation: 2747Reputation: 2747Reputation: 2747Reputation: 2747
just a comment, how it works? http://computerplumber.com/2014/03/m...iles-together/
And another solution:
http://stackoverflow.com/questions/2...mpressing-them
 
Old 11-25-2015, 06:40 AM   #7
michaelk
Moderator
 
Registered: Aug 2002
Posts: 15,808

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

Hmm. cat does work.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
unzipping TOOOOOOOOOOOOOL Linux - Newbie 2 05-08-2013 10:37 PM
LXer: kgdb, To Merge Or Not To Merge LXer Syndicated Linux News 0 02-05-2008 06:10 PM
LXer: KHTML Vs Webkit: To Merge or Not To Merge LXer Syndicated Linux News 0 10-27-2007 06:41 AM
Unzipping ninpow Linux - Newbie 6 01-25-2006 02:43 AM
unzipping files??? linuxnoob1 Linux - Newbie 11 05-24-2005 01:30 AM


All times are GMT -5. The time now is 10:12 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration