In the few cases where that does not apply, you may have used a Microsoft editor such as Notepad and corrupted the unix text file with Microsoft line terminators, and then transferred the file to unix using a BINARY mode ftp file transfer which unlike an ASCII mode ftp file transfer does not convert the format. Often the quickest fix is to re-transfer the file using the correct mode.
In most versions of ftp giving the source file an MSDOS-type file extension of .txt will make the conversion automatic. In unix the MSDOS-type file extensions have no special meaning but are useful for general cross-platform recognition of the contents of a file.
A unix Text File has a line terminator of a single character line-feed .
A Microsoft MSDOS-type Text File has a line terminator of two characters carriage-return then line-feed . This is a historical design error in MSDOS.
In some early versons of Apple MACOS the line terminator for text files is the single character carriage-return . These text files are best converted prior to tranfer to unix. Current versions of Apple MACOS use the unix single character line-feed for a line terminator.
To remove the carriage-return characters with the unix tr (translate) command:
cat old_file.txt | tr -d '\r' > new_file.txt
Or if you system has the utilities, use dos2ux or dos2unix conversion utilities.