You need to remove the Windows carriage return from the lines as well. You see, when a text file is created under Windows, it ends the lines with a carriage return
and a line feed, whereas *nix systems use just a line feed. You can use Perl, tr, sed, or a host of other programs to remove this extra character.
Here is a simple Perl script to remove these extra characters and format the text file properly.