Now that I’ve introduced the format of my todo.txt file, let’s look at what we can do with it. I have a few retrieval commands that I use for pulling information out of my todo.txt file.
Reviewing NA Format
First, it’s been so long since my last post on this topic, how about a little refresher? Here’s the format of a next action line:
[priority] [project] NA [recurrence] [pigpog] context enterdate [startdate] [duedate]
where
[priority]is an optional priority for the NA. I use (!) as my standard priority (brackets are required) and (@) as the priority I associate with GTD-specific next actions, e.g., weekly review. Almost any single character is useful, although I don’t make use of #, ~, or x because these characters mean other things to me.[project]is an optional project name for the NA. I keep track to two kinds of projects, trackable and non-trackable. (This comes into effect when I use the birdseye.py script discussed by Gina Trapani here.) Trackable projects have names like [p:Blog], [p:FixCar]. The square brackets mean “project” and the p: means “trackable”. Non-trackable projects just have the square projects, e.g., [TV], [Tweak].NAis the next action. Every line must have a next action, otherwise, what’s the point. Almost anything goes here, although I avoid using double quotes because they cause havoc with one of my scripts, but single quotes are fine.[recurrence]is an optional reminder for me that a particular NA has a recurrence; I use the format (recur: every…) for this. There’s no specific format, i.e., I don’t have any scripts looking for “recur:”, but it’s a nice format for me.[pigpog]is an optional reminder for me that a particular NA is part of a larger sequence of actions, in the fashion of pigpog. Again, there’s no specific format, but I use (pigpog: …).contextis the context of the next action. All contexts must start with @, e.g., @anywhere, @online, etc. Every line must have at least one context; I tend to use only one, but you could put more if you want.enterdateis the date that this NA was created, in the format e:2006-08-23. I use the entry date in order to keep track of how long an NA has been around - it’s good for determining exactly how many days I’ve been waiting for something, or how stale some NAs are getting. FYI, my stalest NA is 99 days old. GASP. The ironic part? It’s an NA telling me to read the first chapter of a Perl Weekend Crash Course Book!startdateis optional; it the earliest possible date that I could start this NA, if that date is later than today. The start date is in the format s:2006-08-25. I use the start date to hide NAs that can’t be started yet - very useful because my todo.txt file also stands in as part of my Tickler system.duedateis also optional, it is the due date of the particular NA. Yeah, I know, deadlines are frowned upon, but I prefer to have deadlined tasks so that I can see most, if not all, of my NAs in one particular place, and that includes ones with deadlines. Examples of NAs with deadlines are some of my recurring tasks, like downloading transactions to balance my checkbook, washing the car every month, etc.
Retrieval Functions
These are my most commonly used retrieval functions:
- get: get all the NAs that are current for right now. What makes a current next action for me?
- It’s startable, i.e., either there is no start date, or the start date is today or earlier.
- It’s either got no due date, or a due date within the next week.
- These two criteria are built in so that I can use my todo.txt file as a tickler file as well, e.g., a reminder to backup my computer once a month. The system will still work for you even if you don’t want to use start or due dates.
- It’s not a @someday/maybe item. I don’t want to see my @someday/maybes all the time; I’ll look for them specifically.
- getall: this is similar to the get command, but it returns everything, including those NAs that might be on the @waiting list or @someday/maybe list.
- getpri: yeah, yeah, I know, priority is evil. But I use them, for extra special things, or to focus myself. You don’t have to use them. But if you do, you can use this command to find those items that are prioritized.
- getdated: this function doesn’t take an argument, but rather, returns all NAs that have a due date, and sorts them according to the due date. There are several categories: overdue, due today, due in the next week, due in the next month, or due after that.
Now, each of these command can have up to three arguments, i.e., three search terms, connected by “AND”. In other words, if I look for “pear”, I’ll find NAs with “pear” in them. If I look for “pear partridge”, I’ll find things with “pear” and “partridge”. I’ll explain this more in the running example below.
Running Example - Retrieving NAs from the todo.txt File
For the running example, I’m using a fictitious todo.txt file, that hopefully gives you an idea of how flexible this system can really be. I’m going to just pasted in the results of some command line playtime with it, interspersed by my comments.
First, let’s see what NAs I have due soon for my blog. Remember that the get command returns things that are startable, and due no later than a week for now (or don’t have a due date at all.)
Get with One Argument
F:MiscellaneousGTDToDoBlog>get blog=====| blog |=====[ 7] 69 | | | [p:Blog] Create fictitious todo.txt @laptop- e:2006-08-22[ 8] 69 | | | [p:Blog] Post about hotkey @online- e:2006-08-22[ 9] 69 | | | [p:Blog] Update Text Fetish #0 with links (pigpog: Publish post) @online- e:2006-08-22
Now, unfortunately, the spacing shown here is less than optimal. I’ve got the script set up so that the columns are spaced nicely. I’ve even got it set up so that extra long NAs wrap, so they look good in my console window. This is done by way of an argument passed into the script, saying how much wrapping I need. Here’s an image showing what it should really look like:
What do the Columns Mean?
Well, that’s an easy one. First, although I don’t have unique identifiers for individual NAs in the text file, I need to be able to refer to them with other commands. So, every time output gets displayed to me, a line number is shown, e.g., [7] in the image above. You must note though that [7] doesn’t always equal that line; it’s really only good for the current output. So, if I were to delete [7], say by using the “done” command, which I’ll introduce later, then really line [8] becomes [7] because the numbers refer to where that line is in the text file, right now. I just don’t want people thinking that these are unique identifiers, like in a database. This is more transient.
The second column, here, showing 69, is how many days it’s been since I entered this NA into the text file (based on the e:\d\d\d\d-\d\d-\d\d). So, yesterday, when I printed this example out, it was 69 days since 22 Aug 06. This is a way for me to see how stale things are. Unfortunately, these three NAs are particularly stale! Now, if I were to have a start date (s:\d\d\d\d-\d\d-\d\d) in an NA, then this number would be how many days since that NA was startable. So, if startable, then how many days since I could have started it. If no startable, then how many days since I entered it. If you don’t want to use either startable or enter dates, then just an empty column.
The third column, blank, shows how many days until the deadline. These NAs have no deadlines, so empty columns. If the NA were overdue, then the number would be negative, showing how many days overdue.
The next column, blank, would be where priorities would be shown.
The last column is the entire text of the NA. Notice how it wraps prettily :) Notice also that I put extra information in some NA, e.g., (pigpog:…) or (recur:…). This is a way of reminding myself that a particular NA is part of a chain, or a recurring NA that I want to repeat over a certain period.
Get with Two Arguments = AND
F:MiscellaneousGTDToDoBlog>get blog hotkey=====| blog AND hotkey |=====[ 8] 69 | | | [p:Blog] Post about hotkey @online- e:2006-08-22
Remember earlier, when I said that you can have three arguments, and they’re combined with “AND”. Here, I’m searching for both “blog” and “hotkey”, returning the one NA that has both of these terms in it.
How about ORing Two Arguments?
Is it possible to combine arguments with the OR connector? Why yes. Here, you just have to cater to the fact that inside the script is just a test to see if a line matches some text. What you put in your text is your business. For example, when I want to OR two terms, I just feed the script one term, “hotkey|fetish”. When it comes to the test, Perl sees this as asking, does this line have either “hotkey” or “fetish” in it?
F:MiscellaneousGTDToDoBlog>get "hotkey|fetish"=====| hotkey|fetish |=====[ 8] 69 | | | [p:Blog] Post about hotkey @online- e:2006-08-22[ 9] 69 | | | [p:Blog] Update Text Fetish #0 with links (pigpog: Publish post) @online- e:2006-08-22
Most likely, it’s possible to do other fancy things, like other regular expression goodness, in your search term(s). Me, I’m happy with one term, two terms and’d, and two terms or’d.
Getting All NAs for a Context
To find all the (current) NAs for a context, you can just use the context as your search term, e.g., “get @calls”. Here, I’m showing that I can get everything from my @waiting list.
F:MiscellaneousGTDToDoBlog>get @waiting=====| @waiting |=====[ 5] 0 | | | [TV] Waiting for next Hell’s Kitchen @waiting e:2006-10-30
Someday/Maybes
Similarly, I can look for someday/maybe NAs. However, I can’t use the get command. Remember above, when I said that the NAs returned by get were those that I could do now, and weren’t someday/maybes? So, this command will get me nothing.
F:MiscellaneousGTDToDoBlog>get @someday=====| @someday |=====
Instead, I move to the getall command, which will return all NAs, regardless of whether or not they’re startable, whether or not they are due soon, whether or not they are someday/maybes.
F:MiscellaneousGTDToDoBlog>getall @someday=====| @someday (ALL) |=====
=====| Waiting |=====
=====| Someday |=====[ 2] 0 | | | Learn to play piano @someday/maybe e:2006-10-30
Note that there’s also a Waiting section here. Sure, I can get @waiting with the get command, but I use getall normally when I’m looking a project. So, I want all of the NAs for a particular project, and I just want a quick separation between actually do-able NAs, vs. waiting-fors, vs. someday/maybes.
For example, let’s see all of my NAs for my [TV] project.
F:MiscellaneousGTDToDoBlog>getall TV=====| TV (ALL) |=====[ 4] 68 | -68 | | [TV] Get Eureka’s next episode (recur: every wed) @online- e:2006-08-22 s:2006-08-23 d:2006-08-23
=====| Waiting |=====[ 5] 0 | | | [TV] Waiting for next Hell’s Kitchen @waiting e:2006-10-30
=====| Someday |=====
This past printout is a good example to show the due date magic. Line [4] has a due date of 23 Aug 06. I’m a little behind, 68 days to be exact.
Don’t use [ ]
It’s important not to use the square brackets [ ] in your search terms. That’s because in Perl, square brackets are used to denote that any one of the characters inside makes a good match. In other words, when I search for [TV], that means that any NA with a “T” or “V” (or lower case, too I think) is a good match. Not very useful.
F:MiscellaneousGTDToDoBlog>getall [TV]=====| [TV] (ALL) |=====[ 1] 69 | | (!) | Win lottery!!! @anywhere e:2006-08-22[ 4] 68 | -68 | | [TV] Get Eureka’s next episode (recur: every wed) @online- e:2006-08-22 s:2006-08-23 d:2006-08-23[ 6] 69 | -61 | | [p:Bills] Download transactions and balance books @online+ e:2006-08-22 d:2006-08-30[ 7] 69 | | | [p:Blog] Create fictitious todo.txt @laptop- e:2006-08-22[ 8] 69 | | | [p:Blog] Post about hotkey @online- e:2006-08-22[ 9] 69 | | | [p:Blog] Update Text Fetish #0 with links (pigpog: Publish post) @online- e:2006-08-22[ 10] -1 | | | [p:Test] Test #1 Start Date @laptop- e:2006-08-22 s:2006-10-31[ 11] 69 | 14 | | [p:Test] Test #2 Due Date @laptop- e:2006-08-22 d:2006-11-13[ 12] 69 | | | [p:Test] Test #3 No Dates @laptop- e:2006-08-22
=====| Waiting |=====[ 5] 0 | | | [TV] Waiting for next Hell’s Kitchen @waiting e:2006-10-30
=====| Someday |=====[ 2] 0 | | | Learn to play piano @someday/maybe e:2006-10-30
Looking at Projects
So, when looking for a specific project, you could get very specific and even use the p: notation, if you used it in your NAs. Here, I’m searching for current NAs for the p:Test project. See, there is one NA that I can do right now.
F:MiscellaneousGTDToDoBlog>get p:Test=====| p:Test |=====[ 12] 69 | | | [p:Test] Test #3 No Dates @laptop- e:2006-08-22 <
But what about other NAs? Am I missing something? So, let’s look at all NAs associated with this project.
F:MiscellaneousGTDToDoBlog>getall p:Test=====| p:Test (ALL) |=====[ 10] -1 | | | [p:Test] Test #1 Start Date @laptop- e:2006-08-22 s:2006-10-31[ 11] 69 | 14 | | [p:Test] Test #2 Due Date @laptop- e:2006-08-22 d:2006-11-13[ 12] 69 | | | [p:Test] Test #3 No Dates @laptop- e:2006-08-22
=====| Waiting |=====
=====| Someday |=====
This printout tells me that line [10] is an NA, but it’s not startable until tomorrow. Line [11] is another NA, but it’s not really current, because its due date is two weeks away. Line [12] is the only “current’ NA.
Seeing High-Priority NAs
It’s also possible to pull out those high-priority NAs in your system.
F:MiscellaneousGTDToDoBlog>getpri=====| (.) |=====[ 1] 70 | | (!) | Win lottery!!! @anywhere e:2006-08-22
Seeing All NAs with Deadlines
One of my favourite commands is getdated, which retrieves all NAs with a due date (that are startable), and sorts them into a pretty format for me.
F:MiscellaneousGTDToDoBlog>getdated=====| OVERDUE |=====2006-08-23 [ 4] 68 | -68 | | [TV] Get Eureka’s next episode (recur: every wed) @online- e:2006-08-22 s:2006-08-23 d:2006-08-232006-08-25 [ 3] 69 | -66 | | Wash Car @errands e:2006-08-22 d:2006-08-252006-08-30 [ 6] 69 | -61 | | [p:Bills] Download transactions and balance books @online+ e:2006-08-22 d:2006-08-30
=====| DUE TODAY (2006-10-30) |=====
=====| DUE IN NEXT WEEK (on or before 2006-11-06) |=====
=====| DUE IN NEXT MONTH (on or before 2006-11-27) |=====2006-11-13 [ 11] 69 | 14 | | [p:Test] Test #2 Due Date @laptop- e:2006-08-22 d:2006-11-13
=====| DUE LATER (after 2006-11-27) |=====
So, I’ve got three overdue NAs. Nothing due today (well, yesterday, actually, since that’s when I printed this). Nothing due in the next week. One NA due in the next month, and nothing due later on. Note that any NAs with due dates, which also have start dates later than today, are NOT shown. This is because I use this system as my tickler too, and I don’t want to see stuff that I can’t start yet.
Conclusion
the point of this post is to introduce you to the script(s) I use for retrieving information from my todo.txt file. Right now, everything is in one huge perl script, and I don’t know if I want to break it up into individual commands (faster loading) or leave it in one file. So, you don’t get to see the script yet. But, I’m thinking of peeling off several of the commands and uploading the scripts, so you can see what they look like, and maybe even adjust them to your system, if you choose.
















