Table of Contents

SED - Delete - Delete blank lines

Same as “grep '.' ”

sed '/^$/d'                           # method 1
sed '/./!d'                           # method 2

Example

Running that command again this file:

testfile
aaa
 
bbb
ccc

returns:

testfile
aaa
bbb
ccc

Example

cat input.txt | sed '/^$/d' > output.txt