delete blank lines with sed

I have a text file with blank lines fullfilled with spaces and others only containing the "Enter" caracter, the \012.

I would like to eliminate all them with the sed command.

Is it possible?

making: sed '/^$/d' <file should delete the blank lines but doesn't work for the lines that only have \012.

Thanks in advance.

Try this:
sed '/^ *$/d'

1 Like

This thread is ancient, but I wanted to say thanks to Perderabo. Your solution helped me out big time.