Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re: unzipping files with .gz extension

by space_monk (Chaplain)
on Dec 29, 2012 at 19:59 UTC ( #1010846=note: print w/ replies, xml ) Need Help??


in reply to unzipping files with .gz extension

Most tar commands also unzip files (and can create them): for unzipping, tar xvzf yourfile.gz will probably work on Linux and a lot of other Unix systems without going near Perl. Its a bit dirty, but if you are doing it in a Perl script, you can do that as a system command enclosed in backticks. However the other methods suggested are much more preferable if you are doing this within Perl. Update - ignore this reply. I should have read the question more carefully.. :-(

A Monk aims to give answers to those who have none, and to learn from those who know more.


Comment on Re: unzipping files with .gz extension
Re^2: unzipping files with .gz extension
by afoken (Parson) on Dec 29, 2012 at 20:29 UTC
    Most tar commands also unzip files (and can create them): for unzipping, tar xvzf yourfile.gz will probably work on Linux and a lot of other Unix systems without going near Perl. Its a bit dirty, but if you are doing it in a Perl script, you can do that as a system command enclosed in backticks. However the other methods suggested are much more preferable if you are doing this within Perl.

    This is nonsense!

    GNU tar can decompress on the fly, but it DOES NOT decompress non-tar files:

    /tmp>gzip foo.txt /tmp>tar xvzf foo.txt.gz tar: This does not look like a tar archive tar: Skipping to next header tar: Exiting with failure status due to previous errors /tmp>dir total 1 -rw-r--r-- 1 alex users 527 Dec 29 21:21 foo.txt.gz /tmp>

    If you choose to use external tools, use the proper tools. tar is the wrong tool for handling arbitary gzip-compressed files. gzip with the -d switch, gunzip, and zcat are the right tools.

    Alexander

    --
    Today I will gladly share my knowledge and experience, for there are no sweeter words than "I told you so". ;-)

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1010846]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (14)
As of 2014-09-23 15:42 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (227 votes), past polls