HowTo : Remove Blank Lines From a File
Use one of the following commands to remove blank lines from a file.
1. Using the grep command :
2. Using the sed command :
3. Using the awk command :
4. Using the tr command :
You also can pipe the output of each command to a new file, like follows :