(Not tested extensively). A script to add todo’s to todo.txt. Add a crontab each dat at 0:00 with the following script:
#!/bin/bash
SCHEDFILE=$HOME/todo/scheduled.txt
TODOFILE=$HOME/todo/todo.txt
# Look for all date types in scheduled
for RAWDATE in $(egrep -o "^[a-zA-Z]*" $SCHEDFILE); do
# Format date types for date
DATESTR=''
for str in $RAWDATE; do DATESTR+="%$str"; done
# We now have a DATESTR. Let's go and match!
LINEMATCHREGEX="^$RAWDATE "$(date +$DATESTR)"~"
egrep "$LINEMATCHREGEX" $SCHEDFILE|while read addtask; do
# We are getting all the to-add-tasks here. Line by line
echo $addtask | cut -d\~ -f2 >> $TODOFILE
done
done
#Sort todo.txt
sort --human-numeric-sort $TODOFILE > $TODOFILE
The schedule file looks like this:
#
# Scheduled tasks for todo.txt
# Format:
#
# a dow, Mon,Tue,Wed,...
# b moy, Jan,Feb,Mar,...
# d dom, 01..31
# D m/d/y 12/30/12
# F Y-m-d 2012-12-30
# j doy 001..366
a Sun~Zondag iets doen
F 2013-03-05~Datum