User Tools

Site Tools


sed:delete:delete_blank_lines

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
sed/delete/delete_blank_lines.txt · Last modified: 2020/08/17 09:23 by 192.168.1.1

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki