Processing gzipped files with Perl IO:Uncompress 2

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 response

  1. Gamer Wed, 05 Mar 2008 20:32:56 GMT
    looking good
  2. Gamer Wed, 05 Mar 2008 20:33:00 GMT
    looking good
Comments