Cool! Several handy one-liners for use in Sed, the stream editor.
# double space a file
sed G# double space a file which already has blank lines in it. Output file
# should contain no more than one blank line between lines of text.
sed ‘/^$/d;G’# triple space a file
sed ‘G;G’# undo double-spacing (assumes even-numbered lines are always blank)
sed ‘n;d’

2 Comments
lu (1 comments.) on May 14, 2004 at 6:23 am.
i’ve been looking for your mail, can you contact me, please?
Peteris Krumins (1 comments.) on October 8, 2008 at 8:57 am.
Hi.
I wanted to let you know that I wrote an article “Famous Sed One-Liners Explained” which explains all the sed one-liners in that file.
Hope you find it useful!
Sincerely,
Peteris Krumins