How do I add newlines between lines printed on the command line?

sed G 
# option: g G    Copy/append hold space to pattern space.

G is not often used, but is nice for this purpose. sed maintains two buffer spaces: the “pattern space” and the “hold space”. The lines processed by sed usually flow through the pattern space as various commands operate on its contents (s///, p, etc.); the hold space starts out empty and is only used by some commands.

The G command appends a newline and the contents of the hold space to the pattern space. The above sed program never puts anything in the hold space, so G effectively appends just a newline to every line that is processed.


Use awk to add an extra newline. This also lets you filter out things you don't want.

awk '{print $0,"\n"}' | less

Use sed and replace the whole line by itself plus one extra newline character:

grep foo /var/log/maillog | sed -e "s/^.*$/&1\n/"