#!/bin/sh

report=$1
lastsamp=$2
sampfile=$3
markfile=$4

echo "CENSUS REPORT for " >> $report
echo `date` >> $report

echo  "" >> $report

lastdate=`echo $lastsamp | awk -F. ' { print $1 } ' ` 
echo "Subscribed since report of "$lastdate >> $report
echo "" >> $report

comm -13 $lastsamp $sampfile >> $report

echo "" >> $report

echo "Unsubscribed since report of "$lastdate >> $report
echo "" >> $report


comm -23 $lastsamp $sampfile >> $report

echo "" >> $report

echo "Total current subscribers: "`wc -l $sampfile | awk ' { print $1 } ' ` >> $report

echo "With the following users new this season: " >> $report

comm -13 $markfile $sampfile >> $report



