Processing gzipped files with Perl IO:Uncompress 2
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
-
looking good
-
looking good