Sed one-liners

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’

Comments

comments

2 Replies to “Sed one-liners”

Leave a Reply