Monday, June 25, 2007

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 }

Bootp Session Transmit Error

by damonp on June 25, 2007

in Apple / Mac

Has anyone seen this error on a MacBook before:

Apr  3 15:16:10 Phoebe configd[35]: DHCP en2: INIT transmit failed
Apr  3 15:16:10 Phoebe configd[35]: bootp_session_transmit: bpf_write(en2) failed: No buffer space available

This is a real pain in the ass when it happens. The only thing that seems to fix it is to reboot.

The only thing I could find was on Apple’s support forums. But there is still no solution there.

Popularity: 1%

{ 1 comment }