The ^M is due to Windows and Unix using a different characters for newlines.
Windows' newline character shows up as ^M in UNIX text editors.
You can use the dos2unix command to remove the ^M characters. Simply run
dos2unix filename > newfilename
and what you specified as “newfilename” will contain your file, without the ^M characters.
-------
Please visit the source wiki page for the rest of this article.
