Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Perl Way To Gzipping/Joining Multiple Gzip Files

by neversaint (Deacon)
on Nov 04, 2011 at 06:21 UTC ( [id://935839]=perlquestion: print w/replies, xml ) Need Help??

neversaint has asked for the wisdom of the Perl Monks concerning the following question:

Dear Masters,
I have list of gzip files:
file1.gz file2.gz file3.gz
Is there Perl ways to join or compressing these files into one gzip file (one batch file) without having to decompress them individually? Moreover we want to preserve the files in gzip format after unzipping the batch file.

In practice we will use this in a web database (CGI). Where the web will receive a query from user and list out all the files based on the query and present them in a batch file back to the user.

I understand that we can do:
cat file1.gz file2.gz file3.gz > allfiles.gz
However upon gunzipping allfiles.gz the files  file1.gz file2.gz file3.gz were not preserved in their existing gzip format.

---
neversaint and everlastingly indebted.......

Replies are listed 'Best First'.
Re: Perl Way To Gzipping/Joining Multiple Gzip Files
by anneli (Pilgrim) on Nov 04, 2011 at 07:44 UTC

    Is there Perl ways

    Not really, as this is just a question of compression and archival. gzip doesn't do file-separation; it's just stream compression. So if you cat the existing .gz files together, as you see, you get one file back.

    tar is made exclusively for putting multiple files together; have you considered taring the .gzs together? (You'd have .gz.tar instead of .tar.gz, kinda!)

    Or, try .zip or .rar with a zero compression setting (as you will probably incur a size gain trying to compress the already compressed .gzs).

Re: Perl Way To Gzipping/Joining Multiple Gzip Files
by Anonymous Monk on Nov 04, 2011 at 06:43 UTC

    gzip works the way it works, independent of perl, so this is not a perl question :)

    try stuffing the gzipped files into a zip file

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://935839]
Approved by Old_Gray_Bear
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others romping around the Monastery: (5)
As of 2024-04-26 08:40 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found