Processing gzipped files with Perl IO:Uncompress 7

Posted by Peter Burkholder Wed, 02 Jan 2008 19:23:00 GMT

Idiom of the day:


use IO::Uncompress::Gunzip qw(gunzip $GunzipError) ;

foreach $host ( "foo", "bar", "dev", "teset") {
  foreach $site ( "public", "private" ) {
   foreach $date ( "20071223", "20071224", "20071225", "20071226", "20071227", "20071228", "20071229", "20071230", "20071231", "20080101" ) {

     $input="/web/$host/$site/logs/access-$date.gz";
     next unless -f $input;
     my $z = new IO::Uncompress::Gunzip $input or die "IO::Uncompress::Gunzip failed: $GunzipError\n";

        while (<$z>) {
          next unless / 200 /;
          @F=split;
          ($URI, $therest) = split(/\?/, $F[6], 2);
          # perl regex operation on the URI

        }
   }
  }
}
Comments

Leave a comment

  1. Ribbons over 3 years later:
    no kidding,this is a very good blog post,i like the idea how you organize your points of view by authority then you speak about each individually,very smart of you,consider having a new blog reader
  2. provillus reviews over 3 years later:
    it needs a bokmark so i can come back to it later ,nice stuff
  3. Bowtrol over 3 years later:
    hmm ,i'm not sure if this is what i'm looking for but anyway this is interresting and could be useful some day,thanks for taking time to write such cool stuff
  4. Diablo3 over 3 years later:
    Hmm,i see that you made your points,you are really a cool author.
  5. african Mango Reviews over 3 years later:
    When I at first left a comment I clicked the "Notify me when new comments are added" checkbox and now each time a comment is added I get three notification emails with the same comment. Is there any way you can take away people from that service? Thanks a lot!
  6. best sleep aid over 3 years later:
    Stuff like these desurves a twit and maybe a bookmark,your content is very good and i thank you for that
  7. The Diet Solution Program over 3 years later:
    Man where is your RSS feed,don't want to loose this blog ,may help me in my online studies,loads of great stuff
Comments