Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re: tracking progress of gzip'd file

by Vautrin (Hermit)
on Feb 09, 2004 at 23:07 UTC ( [id://327767]=note: print w/replies, xml ) Need Help??


in reply to tracking progress of gzip'd file

If you really want to use a shell script consider chaining in the % wc -l command. That way you could have the first line be the number of lines you have to process. Even better, follow one of the suggestions others have made about opening the file from within perl.

Want to support the EFF and FSF buy buying cool stuff? Click here.

Replies are listed 'Best First'.
Re: Re: tracking progress of gzip'd file
by js1 (Monk) on Feb 10, 2004 at 10:14 UTC

    Thanks for the replies,

    I have taken your advice and coded the gzip from my perl script using Compress::Zlib. However I think I may have ran into a problem already. How do I determine the uncompressed size of the gz file using this module?

    js1.

      I've managed to get it running gzip -l:

      $gziplist=`gzip -l $file`; $gziplist=~/.\n\s*\d*\s*(\d*)/; $filesize=$1;

        Actually, that doesn't quite work because the uncompressed value is shortened:

        $ ls -l SG_BSGL01_main_460110220000.log -rw-r--r-- 1 52359 staff 394629763 Feb 10 11:54 SG_BSGL01_main +_460110220000.log $ ls -l SG_BSGL01_main_460110220000.log.gz -rwxrwxrwx 1 52359 staff 75011313 Jan 13 15:43 SG_BSGL01_main_ +460110220000.log.gz $ gzip -l SG_BSGL01_main_460110220000.log.gz compressed uncompr. ratio uncompressed_name 75011313 3486 -57182.0% SG_BSGL01_main_460110220000.log

        How do you know what units the size is in?

        js1.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others having an uproarious good time at the Monastery: (6)
As of 2024-04-25 15:02 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found