Converting dos to unix ascii files

There is just nothing in this world that is universal and that even includes straight up text files. When carriage returns are stored in windows they are stored as Carriage Return & Line Feed, however, in unix they are stoed as just Carriage Return.

So when you ftp a file from windows to unix sometimes you will see ^M characters at the end of each line. This is because the files has been transferred as a binary file versus an ascii file. Most ftp (sftp, ftps, etc..) programs will convert the carriage returns correctly if the file is set to transfer in ascii mode based on the operating system it is going to.

However, if by chance you end up with a “dos” based file on your unix system and you want to convert it. A quick simple trick is to use the vi editor using the the :set ff command.

Simply open the text file in the vi editor, and type
:set ff=unix

This will change the file format from dos to unix based and the carriage return problem should be solved!