#!/bin/csh -f
###################################
# Look through the recent WWW access logs from the cismm.org machine to find who accessed the
# CISMM Video Optimizer download page.  These logs need to have been copied to
# ~taylorr/tmp/cismm.org_logs
###################################

cd /afs/cs.unc.edu/project/cismm/web_logs

rm ~/tmp/cismm_opt_total_list

foreach p (`ls *access_log-*`)
	rm ~/tmp/cismm_opt_list
    #cat $p | grep -E 'GET .*cismm_video_optimizer|GET .*Video_Optimizer_v2.3_Intel_Mac_Universal' | grep -v 152.2. | tee ~/tmp/cismm_opt_list	
    cat $p | grep -E 'cismm_video_optimizer|Video_Optimizer_v2.3_Intel_Mac_Universal' | tee ~/tmp/cismm_opt_list	
    #gunzip < $p | grep '/cismm/download/cismm_videooptimizer/cismm_video_optimizer_' | grep -v 152.2. | tee ~/tmp/cismm_opt_list
	#gunzip < $p | grep '/wp-content/downloads/setup_cismm_video_optimizer' | grep -v 152.2. | tee -a ~/tmp/cismm_opt_list
    #gunzip < $p | grep '/wp-content/downloads/Video_Optimizer_v2.3_Intel_Mac_Universal.dmg' | grep -v 152.2. | tee -a ~/tmp/cismm_opt_list
	#gunzip < $p | grep 'download/17' | grep -v 152.2. | tee -a ~/tmp/cismm_opt_list
	cat ~/tmp/cismm_opt_list >>! ~/tmp/cismm_opt_total_list
end

echo "Total number of unique off-site hits:"
cut -f1 -d" " ~/tmp/cismm_opt_total_list | sort | uniq | wc

echo "Total number of weeks:"
ls access_log* | wc

echo "Months covered:"
cut -f2 -d"/" ~/tmp/cismm_opt_total_list | sort | uniq

