All pastes #985516 Raw Edit

Anonym

public text v1 · immutable
·published 2008-04-15 02:10 UTC
rendered paste body
#!/usr/local/bin/perl -w

open(FILE2, "acces.log");

while (<FILE2>) {
	$temp .= $_;
}

close(FILE2);

print "\nPlease input the date like this: day month year hour minute\n";
print "Example: for February 12th 2006, 19:04 just write 12 02 2006 19 04\n\n";
print "Date: ";

$input = <STDIN>;
if ($input =~ m/(\d+)\s(\d+)\s(\d+)\s(\d+)\s(\d+)/ ) {
	$day = $1;
	$month = $2;
	$year = $3;
	$hour = $4;
	$minute = $5;
	
	$matched = 0;
	
	if ($month eq "01") { $month_match = "Jan" };
	if ($month eq "02") { $month_match = "Feb" };
	if ($month eq "03") { $month_match = "Mar" };
	if ($month eq "04") { $month_match = "Apr" };
	if ($month eq "05") { $month_match = "May" };
	if ($month eq "06") { $month_match = "Jun" };
	if ($month eq "07") { $month_match = "Jul" };
	if ($month eq "08") { $month_match = "Aug" };
	if ($month eq "09") { $month_match = "Sep" };
	if ($month eq "10") { $month_match = "Oct" };
	if ($month eq "11") { $month_match = "Nov" };
	if ($month eq "12") { $month_match = "Dec" };
	
	$matchstring = $day.'/'.$month_match.'/'.$year.':'.$hour.':'.$minute.':';
	$matchstring_2 = ' \+0200] "GET';
	
	while ($temp =~ s/($matchstring)(..)($matchstring_2)/matched/) {	
		$matched++;
	}
	print "\n".$month_match.". ".$day.", ".$year."   ".$hour.":".$minute;
	print "\nThere are " . $matched . " GET's in this minute.\n";
} else {
	print "\nInput error. Please try again.";
}