#!/bin/sh
# statistic - computes some stupid statistics on a log file of `grev'
#

if [ $# -eq 0 ]; then
	echo "Usage: statistic log-file [log-history]"
	echo "Displays statistics about the log file in the log-history"
	exit 1
fi

if [ $# -ge 2 ]; then
	exec 1>> $2	# append all output to second argument
fi

echo `whoami` "-" `date`
echo "total words  " `cat $1 | wc -l`
echo "unknown      " `grep "[-] 0 " $1 | wc -l`
echo "known once   " `grep "[-] 1 " $1 | wc -l`
echo "known better " `grep "[-] [23] " $1 | wc -l`
echo "known surely " `grep "[-] 4 " $1 | wc -l`
echo

