# !/bin/ksh # Author: ER/CR 09/20/95 # Script will pull together all new faxes and authors # on or after a variable date and group them by team. # The output will go into a file called author.report . /u/hsim/other/fax.data/scripts/setvars # Go to db and get # the following fields: author, create date, group name. cd $TMPDIR cut -c$AU_COLS $FAXDB >au$$ cut -c$NEW_COLS $FAXDB >new$$ cut -c$CMP_COLS $FAXDB >cmp$$ # Put all the fields together in one tmp file # tmp file is rpt paste -d " " new$$ au$$ cmp$$ > rpt$$ # Compare the variable date with the new$$ field in rpt # output the result in rpt # $1 is the yymmdd variable given in the get.qnew.faxes command while read line; do echo $line | read v1 v2 v3 v4 [[ $v1 = 9* ]] && [ "$v1" -ge $1 ] && echo $line done < rpt$$ >tmp$$ # mv tmp$$ /u/hsim/other/fax.data/author.report # Add sort feature and rename the report with a date string for # archive purposes month=`date +%m` day=`date +%d` year=`date +%y` outfile=/u/hsim/other/fax.data/author.reports/author.report.$year$month$day mv tmp$$ $outfile rm *$$ # 09/28/95 # sort the $outfile, give a total of all new faxes for the Quarter, # sort by author and total for each author # sort by group and total for each group cd /u/hsim/other/fax.data/author.reports cat author.report.$year$month$day wc -l author.report.$year$month$day | read count echo "Total Count=$count" >> author.report.$year$month$day # sort -t" " +1 author.report.$year$month$day # grep grp author.report.$year$month$day | wc -l sort -t" " +1 author.report.$year$month$day > $sorted.file acount=0 prev_author= while read date author group do if [ "$author" = "$prev_author" ] then ((acount=acount+1)) else echo "author=$prev_author, count=$acount" acount=1 prev_author=$author fi done <$sorted.file >>author.report.$year$month$day # sort -t" " +2 author.report.$year$month$day # grep grp author.report.$year$month$day | wc -l sort -t" " +2 author.report.$year$month$day > $group.file acount=0 prev_group= while read date author group do if [ "$group" = "$prev_group" ] then ((acount=acount+1)) else echo "group=$prev_group, count=$acount" acount=1 prev_group=$group fi done <$group.file >>author.report.$year$month$day # remove tmp files from /scripts/tmp rm tmp* rm cmp* rm new* rm rpt*