Most of my development works are done on Linux/Unix. I use / evaluate a lot of open source projects and some files has ^M when edited from this platform. This is because the file was saved in dos format which uses a different EOL (end of line character).
To overcome this problem, just run this simple unix command:
$ dos2unix <filename>
Note that the original file will be overwritten. Do a ‘man’ to check options available for this command.
End Of Line
Different systems uses different EOL characters, which also known as line break or newline.
Unix uses ‘\n’. Windows uses ‘\n\r’. Apple/Mac uses ‘\r’.
Other EOL conversion commands: unix2dos, mac2unix, unix2mac, mac2dos, dos2mac.