How I was able to remove it in vi editor:
:%s/
^M
//g
:%s/^M
Good luck!
If you just need to remove the ^M characters (not replace them with \n):
\n
sed -i -e 's/\r//g' yourfile.txt
If you want to replace them with \n:
sed -i -e 's/\r/\n/g' yourfile.txt
You can install and use dos2unix. After Installation just run:
>dos2unix yourfile.txt