Remove blank lines from a file using grep
How can I remove blank lines from a file in UNIX?
grep -v "^$" filename > newfilename
The ^$ within the quotes is a regular expression: ^=beginning of line, $=end of line, with no characters between.
See additional helpful information in the comments below.
Follow the reactions below and share your own thoughts.