I\'ve used a grep command with sed and cut filters that basically turns my output to something similar to this
this line 1 this line 2 another li
Use grep "^." filename to remove blank lines while printing.Here,the lines starting with any character is matched so that the blank lines are left out. ^ indicates start of the line. . checks for any character.
grep "^." filename
^
.