Jan 072009
Remove empty lines in a file
Answer
Pick any one of the following methods.
1. grep
grep . test.txt
2. sed
sed '/^$/d' test.txt
3. awk
awk NF test.txt
4. tr
cat test.txt | tr -s "\n"
5. perl
perl -n -e 'print unless /^$/' test.txt