..

Remove blank lines from files

sed '/^$/d' inputfile.txt > outputfile.txt

or

grep -v '^$' inputfile.txt > outputfile.txt

Both grep and sed use the special pattern ^$ that matches blank lines. The -v switch on grep is used to select lines not matching any of the specified patterns.

More information on the following links:

https://developer.apple.com/library/mac/documentation/Darwin/Reference/ManPages/man1/sed.1.html

https://developer.apple.com/library/mac/documentation/Darwin/Reference/ManPages/man1/grep.1.html