Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Caezar

macrumors 6502
Original poster
I am trying to clean in Textmate some articles I downloaded from Factiva, before I send them to my Sony Reader. I created a command in the Bundle Editor to remove blank lines:

sed /^$/d

It works, but now I want to add a new twist and remove blank lines, as well as lines that contain a single space. I tried the following but it does not work:

sed /^$/d
sed /^\s$/d

Any idea?
 
i don't think sed understands the backslash s. Try using an actual space or use [[:space:]].

Yep, this does work:

Code:
sed /^[[:space:]]$/d

The key is you do need to use double brackets. This isn't really clear from the TextMate manual. This will not work:

Code:
sed /^[:space:]$/d
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.