Tuesday, June 27, 2006

Joining lines in sed

I copied some text from a web page. I wanted to print the doc. It was pre aligned. When I copied it to my word processor, it was not aligned properly and it ate up lot of space. I wanted to combine the lines to a single paragraph. Since Im not much familier with the word processor, I decided to use sed. After googling, I found

sed -e :a -e '$!N;s/\n\([a-zA-Z]\)/\1/;ta' -e 'P;D'

Done...

No comments: