my $in = @ARGV[0];
open (IN, $in);
my $f = '';
while (my $str =
{
$str =~ m#\[(\d{2})/(\w{3})/(\d{4}):.*]#;
#print "$3$2 $str \n";
my $cur = "$3$2";
if ( $cur ne $f)
{
if ($f ne '') {close OUT;}
$f = $cur;
open (OUT, "> $f-$in");
print "$f-$in\n";
}
print OUT $str;
}
close IN;
close OUT;
#return 0;
exit 0;
#in: parse.pl access_log
#out: 2011Feb-access_log, ...
Комментариев нет:
Отправить комментарий