diff options
author | Silvio Rhatto <rhatto@riseup.net> | 2015-07-31 20:22:58 -0300 |
---|---|---|
committer | Silvio Rhatto <rhatto@riseup.net> | 2015-07-31 20:22:58 -0300 |
commit | cc760471fc7e1ad008c8e461a826e8e1093183ff (patch) | |
tree | 856028e0269239aa34cba44651e2076cf284bfbe /calendar-archive | |
parent | 3d802bfe0c3afb8b2bab044a71ad47de5507442a (diff) | |
download | utils-calendar-cc760471fc7e1ad008c8e461a826e8e1093183ff.tar.gz utils-calendar-cc760471fc7e1ad008c8e461a826e8e1093183ff.tar.bz2 |
Adds calendar-archive
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 |