An introduction

This is a semi-public place to dump text too flimsy to even become a blog post. I wouldn't recommend reading it unless you have a lot of time to waste. You'd be better off at my livejournal. I also have another blog, and write most of the French journal summaries at the Eurozine Review.

Why do I clutter up the internet with this stuff at all? Mainly because I'm trying to get into the habit of displaying as much as possible of what I'm doing in public. Also, Blogger is a decent interface for a notebook

Tuesday, May 17, 2011

Removing whitespace with sed

Use sed to remove leading whitespace:

sed 's/^[ \t]*//'


The particular reason I want to do this is to turn my todo-list (a tree of tasks, marked off by when i completed them), into a sorted record of what I've done on a particular day. In other words, I want to go from this:


Code
Thule
OED javascript
other tasks
2011-04-17 16:57:33 Sort out markdown for vim 45m
blah
Thing I haven't done


To this:

2011-04-17 15:58:32 update blog with more cmds 3m
2011-04-17 15:58:59 modify timestamp to include date 20m [,,T,,D wil do for now]
2011-04-17 16:57:33 Sort out markdown for vim 45m
2011-04-17 17:39:04 [email to ejc about resources for journalists


Which can be done by removing whitespace, limiting to lines containing dates, and sorting


$ cat todo/todo.otl| sed 's/^[\t ]*//' | grep 2011 | sort

No comments:

Post a Comment