#! /bin/csh
cd /home/meteor/x/class/jhorel/web_log
# must be logged onto meteor
#
# input log file
set log = $1
#
# by location
#
set total = ` wc -l < $log `
#@ no_file = $total / 75000  
#echo $no_file $total
#@ nm1 = $no_file - 1
#rm -f xx*
#rm -f temp.*
#set ct = 1
#set string = ""
#while  ( $ct <= $no_file )
#@ no = 75000 * $ct
#set string = "$string $no"
#@ ct = $ct + 1
#end
 
#echo $no_file
#csplit -k -s $log  $string
#set ctr = 0
#cut -d" " -f1 -s xx00 > temp.0
#while ( $ctr < $no_file ) 
#@ ctr = $ctr + 1
#echo $ctr
#if ($ctr < 10 ) then
#cut -d" " -f1 -s xx0$ctr > temp.$ctr
#else
#cut -d" " -f1 -s xx$ctr > temp.$ctr
#endif
#cat temp.$ctr >> temp.0
#end
#sort -f -i < temp.0 | uniq -c | sort -r -t" " -n > location.stat.past
##
#cumulative statistics
#
set met = 'met\.utah\.edu'
set mines = 'mines\.utah\.edu'
set utah = 'utah\.edu'
set edu = '\.edu'
set com = '\.com'
set state = 'ut\.us'
set gov = '\.gov'
set net = '\.net'
set mil = '\.mil'
set met_count = ` grep -c $met $log `
set mines_count = ` grep -c $mines $log `
set utah_count = ` grep -c $utah $log ` 
set state_count = ` grep -c $state $log ` 
set edu_count = ` grep -c $edu $log  ` 
set gov_count = ` grep -c $gov $log  ` 
set com_count = ` grep -c $com $log ` 
set net_count = ` grep -c $net $log `
set mil_count = ` grep -c $mil $log `
@ other_utah = $utah_count - $met_count - $mines_count
@ other_edu = $edu_count - $utah_count
@ sub_total = $edu_count + $gov_count 
@ sub_total = $sub_total + $com_count
@ sub_total = $sub_total + $net_count
@ sub_total = $sub_total + $state_count
@ sub_total = $sub_total + $mil_count
@ other = $total - $sub_total
echo $met_count $mines_count $other_utah $other_edu $state_count $gov_count $com_count $net_count $mil_count $other $total > cumulative.stat.past 
