#!/usr/bin/perl ###use strict; use Getopt::Long; use Time::Local; my $file="access_log_modified"; my $begin_time = ""; my $end_time; my @visual_pages = (); my @final_visual_pages = (); my %increment = (); my ($datetime, $get_post, $Day, $Month, $Year, $Hour, $Minute, $Second); my $interval = 60; #An interval of 1 minute count_recs(); sub count_recs { open (INFILE, "<$file") || die "Cannot read from $file"; WHILELOOP: while () { ($datetime,$get_post) = (split / /) [3,6]; $datetime =~ s/\[//; ($Day,$Month,$Year,$Hour,$Minute,$Second)= $datetime =~m#^(\d\d)/(\w\w\w)/(\d\d\d\d):(\d\d):(\d\d):(\d\d)#; next WHILELOOP if ($get_post =~ /\.js$/ || $get_post =~ /\.gif$/ || $get_post =~ /\.css$/); unless ($begin_time) { $begin_time = $datetime; } push (@dates, $datetime); } #outer while foreach $dateproc (@dates) { $increment{$dateproc}++; } foreach $dateproc (sort keys %increment) { push (@{$processed_visual_pages{$dateproc}}, $increment{$dateproc}); print "$dateproc @{$processed_visual_pages{$dateproc}}\n"; } close(INFILE); }