#!/bin/bash
# uthx_dates: add dates to the first column of a uthx donations file
# e.g. uthx_dates <thx
#      uthx_dates <thx 2 weeks
#      uthx_dates <thx 1 month 5 days
period_num=${1:-1}
period_type=${2:-month}
shift;shift
N=0
while IFS='	' read D X; do
	if [ -z "$X" ]; then X=$D; fi
	D=`date +%Y-%m-%d -d "$* $N $period_type"`
	echo $D'	'$X
	N=$(( $N + $period_num ))
done
