diff options
Diffstat (limited to 'calendar-archive')
-rwxr-xr-x | calendar-archive | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/calendar-archive b/calendar-archive new file mode 100755 index 0000000..0b7b3df --- /dev/null +++ b/calendar-archive @@ -0,0 +1,32 @@ +#!/bin/bash +# +# Remind rotator. +# + +# Parameters +CWD="`pwd`" +REMINDERS="$HOME/.remind" +YEAR_START="2009" +YEAR_END="`date +%Y`" +REGEXP="" + +# Setup +cd $REMINDERS + +# Archive old entries +for year in `seq $YEAR_START $YEAR_END`; do + REGEXP="$REGEXP -e /$year/d" + mkdir -p $REMINDERS/archive/$year + + for file in *.rem; do + grep " $year " $file > archive/$year/$file + done +done + +# Cleanup current reminders +for file in *.rem; do + sed -i $REGEXP $file +done + +# Teardown +cd $CWD |