tcsh

Stats from apache log files

Snippet

Quick generation of numbers of total page hits on a server with apache log files.

#!/usr/bin/env tcsh
 
# not bash, actually, tcsh
 
foreach g (01 02 03 04 05 06 07 08 09 10 11 12)
foreach f (01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31)
echo -n "2008-" >> ~/scores-stats-2008.txt
echo -n $g >> ~/scores-stats-2008.txt
echo -n "-" >> ~/scores-stats-2008.txt
echo -n $f >> ~/scores-stats-2008.txt
echo -n "  " >> ~/scores-stats-2008.txt
grep /scores/ serverx.example.org-access_log.2008-$g-$f | wc -l >> ~/scores-stats-2008.txt
end
end