#!/bin/sh

for year in 2000 2001 2002 2003 2004 2005 2006 ; do
	for month in `seq 1 12`; do
		curdate="${year}-${month}-01";
		echo -n "$curdate,";
		nextmonth=$(($month+1))
		if [ $nextmonth -gt 12 ] ; then
			nextyear=$((year+1))
			nextmonth=1
		else
			nextyear=$year
		fi
		nextdate="${nextyear}-${nextmonth}-01";
		for release in sarge woody potato slink; do
		  vulncount=`echo "select count(dsaid) from dsa where releases like '%${release}%' and  date < '${nextdate}' and date >= '${curdate}' ; " | psql -q -t metavuln`
		  echo -n "$vulncount, ";
		done
		echo
	done
done

exit 0

