How Do I Remove Blank Lines in Linux?
Contents How Do You Remove Blank Lines in Linux? Simple Solution Is by Using Grep (Gnu or Bsd) Command as Below. Remove Blank Lines (Not Including Lines with...
Contents
How do you remove blank lines in Linux?
Simple solution is by using grep (GNU or BSD) command as below.
- Remove blank lines (not including lines with spaces). grep . file.txt.
- Remove completely blank lines (including lines with spaces). grep “S” file.txt.
Must Read
How do I remove blank lines in Unix?
The d command in sed can be used to delete the empty lines in a file. Here the ^ specifies the start of the line and $ specifies the end of the line. You can redirect the output of above command and write it into a new file.