sed: replacing multiple empty lines with one dandelion 9 years ago As simple as: sed -e '/^$/N;/^\n$/D' <file>