home *** CD-ROM | disk | FTP | other *** search
/ Internet 1996 World Exposition / park.org.s3.amazonaws.com.7z / park.org.s3.amazonaws.com / Japan / LOGS / stat.pl < prev   
Perl Script  |  2017-09-21  |  805b  |  35 lines

  1. #!/usr/local/bin/perl
  2.  
  3. open(AWHTML, "$ARGV[0]") || die "open" ;
  4.  
  5. @datestr = split(/\./, $ARGV[0]) ;
  6. $date = $datestr[0] ;
  7.  
  8. while (<AWHTML>) {
  9.     chop ;
  10.  
  11.     if (m#Avg Accesses/Hour[^0-9]+([0-9\.]+)#) {
  12.         $avgacc = $1 ;
  13.     } elsif (m#Max Accesses/Hour[^0-9]+([0-9\.]+)#) {
  14.         $maxacc = $1 ;
  15.     } elsif (m#Min Accesses/Hour[^0-9]+([0-9\.]+)#) {
  16.         $minacc = $1 ;
  17.     } elsif (m#Accesses/Day[^0-9]+([0-9\.]+)#) {
  18.         $totacc = $1 ;
  19.     } else {
  20.         if (m#<B>([0-9\.]+)</B> unique host#) {
  21.             $tothosts = $1 ;
  22.         }
  23.         if (m#<B>([0-9\.]+)</B> pages related#) {
  24.             $avgpages = $1 ;
  25.         }
  26.         if (m#total of <B>([0-9\.]+)</B> hits and <B>([0-9\.]+)</B> errors#) {
  27.             $tothits = $1 ;
  28.             $toterrs = $2 ;
  29.         }
  30.     }
  31. }
  32.  
  33. print "$date totacc=$totacc tothosts=$tothosts tothits=$tothits" ;
  34. print " maxacc=$maxacc minacc=$minacc toterrs=$toterrs\n" ;
  35.