blob: 0b7b3dfbc383824ff62b9efcc0fdacc24ebb5ebd (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
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
|