Regular and Recurring Tasks in todo.txt

I’m using todo.txt format to keep some of my daily tasks. It’s a plain text format and both iOS and Android has apps, like SimpleTasks. Emacs and Vim has support for the format too. Actually you don’t need a special editor for it, the format is so simple that even Notepad may be enough.

I have a shell script to add daily recurring tasks, like Drink Water or Pray Maghreb to this file. SimpleTasks needs the file to be in $HOME/Dropbox/todo/todo.txt and I’m using a template file, say template.txt to populate the file. However, as any person that has used TODO files knows, there are unfinished tasks and I’m not always drinking my daily allotted water.

So, my evening script moves the DONE to its own file, removes the regular parts from todo.txt and repopulates them for a new day. (The code is not usable as is, you need to define TODO, DONE and TEMPLATE file paths correcty.)


TODO=.../todo.txt
DONE=.../$(date +%F)-done.txt
TEMPLATE=.../template.txt

#Move Done to $DONE
grep -wE '^x ' $TODO >> $DONE
sed -i '/^x /d' $TODO

#Delete lines with @Evening, @Morning or @Regular tags from todo
sed -i "/\b\(@Morning|@Evening|@Regular\)\b/d" $TODO
cat $TODO_TEMPLATE >> $TODO

I have instructed cron to run this everyday, at 6 PM. (My evening is earlier than morning.)