Removing ^M characters
If you have been using Linux in a mixed environment for any amount of time you have probably come across the dreaded ^M. That nasty control character can mess up compiling and render scripts useless unless they are removed. Here is a quick command line sed maneuver you can use to get rid of them. Oh, and remember, to create the control character, don’t use the carrot symbox(^) + M, you have to use Ctrl+V then Ctrl+M to create it, or else it means something totally different.
sed -i 's/^M/\n/g' fileToReplaceControlChars.txt