Q:

Can I use the sed command to replace multiple empty line with one empty line?

I know there is a similar question in SO How can I replace mutliple empty lines with a single empty line in bash?. But my question is can this be implemented by just using the sed command?
Thanks

A:

Give this a try:
sed '/^$/N;/^\n$/D' inputfile

