Lifehacks

Grep Replace and Word Processing

by damonp on June 25, 2007

in Lifehacks,Snippets

I spend so much time in a text editor, its hard to get my head around a word processor sometimes. Text and formatting at the same time?

Moving some content around I found myself with a ton of links formatted in an unordered list. I only needed the plaintext of the name and link separate for the current project. My trusty BBEdit with Grep search and replace support yield the following search and replacement patterns to make quick work of the list.

Search Grep Pattern

<li><a href="(.*)">(.*)<\/a> ?<strong> ?\((.*)\)<\/strong><\/li>

Replace Grep Pattern

\2\t\(\3\)\r\1\r

Turned this

<li><a href="http://www.agentb.com/">AgentB</a> <strong> (Deals)</strong></li>

into this

AgentB  (Deals)
http://www.agentb.com/

I always keep an empty BBedit window for text processing like this. Its easy to paste a chunk of text, process it and then paste it back into your word processor.

Note:
I’m almost good enough at Grep search patterns to make this viable in all situations. It used to take me 5 minutes to debug and expression that would have taken 2 minutes to cut and paste manually. I had this one whipped out in much less time than it would have taken to manually cut and paste a hundred of these.

Popularity: 1%

{ 0 comments }

Todo.txt – A Command Line Task Tracker

by damonp on March 28, 2007

in Lifehacks

I found Todo.txt by Gina Trapani, randomly last weekend and have been playing with it all week. Todo.txt is a todo list written in shell script. It should run fine under any system that supports a Unix like shell… Linux, OS X, Cygwin etc.

At any given time I have a half dozen post-it pads going with todo lists, usually the things that have to get done TODAY! Todo.txt is so simple to use I’ve misplaced most of my post-it pads (still need paper for the grocery list). :-)

Some examples:

todo.sh add This is my first task
todo.sh add Another task
todo.sh list
02 Another task
01 This is my first task
--
TODO: 2 tasks in /Users/damonp/etc/todo.txt.

Set task number one to the highest priority, A.

todo.sh pri 1 A
todo.sh list
01 (A) This is my first task
02 Another task
--
TODO: 2 tasks in /Users/damonp/etc/todo.txt.

I haven’t gotten much further than adding, prioritizing and marking off items, but the builtin help shows options for archiving, reporting, appending, prepending and deleting items.

Popularity: 1%

{ 0 comments }

Advanced OSX Mail Searches

25 March 2007

When you live and breathe email for work and play, it can be quite important to keep messages around for reference. In my business, client and project specific correspondence is supremely important as a record of what has been done, what needs done and project cost quotes among other things. The important information usually gets [...]

Read the full article →

Hack to Open Popup Pages in Main Window

15 December 2006

I hate popups and links that open in a new window. I can control where I want windows to open. If I want a new window or tab, I’ll use the appropriate key combinations when clicking the link. If a window opens in a popup without a menu bar or url bar, hit Apple + [...]

Read the full article →

Use Google As Caller ID

18 April 2006

Receive a call from a number you don’t recognize? Google it and see what pops up. If its a call from a business, they’re likely to have their telephone number listed on a website somewhere. I have found these forms work the best: ###-###-#### ###-#### You can always Google the three digit area code to [...]

Read the full article →

Use a Read Folder to Keep Track of ToRead Items

19 September 2005

I typically keep a half dozen browser windows open, each with as many tabs. I use them as reminders; things to do, blog posts or articles that I want to read by haven’t had time, current projects, stats of sites I’m monitoring etc. With CodeTek VirtualDesktop it’s easy to get things all spread out. Lately [...]

Read the full article →

Tech Overload

16 August 2005

Why are tech types of all ages inclined to sit in front of a computer for 10, 12, 14 or more hours a day, weeks on end? They (we) replace real life, tangible experiences for ones experienced through a 20″ monitor, keyboard and mouse. This reminds me of a Frank Lloyd Wright quote: If it [...]

Read the full article →