Delete empty lines and lines only with white spaces from a file
Aug 02, 2019 10:10 pm
Below command helps me to remove only blank or empty lines from a file. Bit it not removes a line with white space.
sed '/^$/d' filename > filename.temp
Aug 02, 2019 10:11 pm
sed '/^ *$/d' filename > filename.tmp filename.tmp > filename
This will remove blank lines and lines with only white spaces from a file.
Leave a reply