[Prev][Next][Index][Thread]

Re: Perl script




...

	This may be over simplied, but:

#!/usr/local/bin/perl
#
# quickcount.pl
#
# Quick counter thingie.
#
chop ($date = `date +%d/%b/%Y`);
$logfile = "/usr/local/spool/httpd/httpd-log";
$webarea = "/usr/local/lib/www";
 
$filename = $ARGV[0];
 
if (-f "$webarea/$filename")
{
        @countarray = `grep $date $logfile | grep $filename`;
 
        print "grep $date $logfile | grep $filename\n";
 
        $count = $#countarray + 1;
 
        print "Today ($date) access: $count\nLinks off from $filename\n";
}

	Will give you the count, and then you can just pipe it off to
whatever file you want. . .

	$logfile and $webarea needs to be set, of course.  So, if
you're Web files are in /usr/local/lib/www, and you've got your vlib
stuff in a subdirectory "vlib", then something like this:

	quickcount.pl vlib/statistics.html

	Should work.

Follow-Ups: References: