REMOVING BLANK LINES
To remove blank lines from a file using sed, use the following:
sed -e '/^$/d' filetoread >filetowrite
The ^ matches the beginning of a line and the $ matches the end.
The two of them together matches a line that begins and ends with
nothing in between (blank line).
The d just says delete the lines for which we have a match.
Since the standard operation of sed is to print every line,
all lines exept blank lines will be sent to filetowrite.