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

Leave a comment

Your email address will not be published. Required fields are marked *