#!/bin/csh -f
###################################
# Look through the recent WWW access logs from the cismm.org machine to find who accessed the
# Template-based matching 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_template_total_list

foreach p (`ls *access_log-*`)
	rm ~/tmp/cismm_template_list
    cat $p | grep -E 'template_based_matching' | tee ~/tmp/cismm_template_list
	#gunzip < $p | grep '/cismm/download/templatebasedmatching/template_based_matching_v' | grep -v 152.2. | tee ~/tmp/cismm_template_list
	#gunzip < $p | grep '/wp-content/downloads/setup_template_based_matching' | grep -v 152.2. | tee -a ~/tmp/cismm_template_list
	#gunzip < $p | grep 'download/15' | grep -v 152.2. | tee -a ~/tmp/cismm_template_list
	cat ~/tmp/cismm_template_list >>! ~/tmp/cismm_template_total_list
end

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

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

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

