LinuxQuestions.org
Share your knowledge at the LQ Wiki.
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, 09: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, 12:53 PM   #2
jpollard
Senior Member
 
Registered: Dec 2012
Location: Washington DC area
Distribution: Fedora, CentOS, Slackware
Posts: 4,604

Rep: Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241
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, 03:07 PM   #3
John VV
LQ Muse
 
Registered: Aug 2005
Location: A2 area Mi.
Posts: 16,825

Rep: Reputation: 2408Reputation: 2408Reputation: 2408Reputation: 2408Reputation: 2408Reputation: 2408Reputation: 2408Reputation: 2408Reputation: 2408Reputation: 2408Reputation: 2408
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, 04:37 AM   #4
Valery Reznic
ELF Statifier author
 
Registered: Oct 2007
Posts: 675

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, 06:42 AM   #5
michaelk
Moderator
 
Registered: Aug 2002
Posts: 14,948

Rep: Reputation: 1530Reputation: 1530Reputation: 1530Reputation: 1530Reputation: 1530Reputation: 1530Reputation: 1530Reputation: 1530Reputation: 1530Reputation: 1530Reputation: 1530
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, 07:09 AM   #6
pan64
LQ Guru
 
Registered: Mar 2012
Location: Hungary
Distribution: debian i686 (solaris)
Posts: 8,124

Rep: Reputation: 2271Reputation: 2271Reputation: 2271Reputation: 2271Reputation: 2271Reputation: 2271Reputation: 2271Reputation: 2271Reputation: 2271Reputation: 2271Reputation: 2271
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, 07:40 AM   #7
michaelk
Moderator
 
Registered: Aug 2002
Posts: 14,948

Rep: Reputation: 1530Reputation: 1530Reputation: 1530Reputation: 1530Reputation: 1530Reputation: 1530Reputation: 1530Reputation: 1530Reputation: 1530Reputation: 1530Reputation: 1530
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 11:37 PM
LXer: kgdb, To Merge Or Not To Merge LXer Syndicated Linux News 0 02-05-2008 07:10 PM
LXer: KHTML Vs Webkit: To Merge or Not To Merge LXer Syndicated Linux News 0 10-27-2007 07:41 AM
Unzipping ninpow Linux - Newbie 6 01-25-2006 03:43 AM
unzipping files??? linuxnoob1 Linux - Newbie 11 05-24-2005 02:30 AM


All times are GMT -5. The time now is 02:21 AM.

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