'^M' character at end of lines

Paul Reiners picture Paul Reiners · Sep 15, 2008 · Viewed 110.6k times · Source

When I run a particular SQL script in Unix environments, I'm am seeing a '^M' character at the end of each line of the SQL script as it is echoed to the command-line. I don't know on which OS the SQL script was originally created.

What is causing this and how do I fix it?

Answer

Thomas Owens picture Thomas Owens · Sep 15, 2008

It's caused by the DOS/Windows line-ending characters. Like Andy Whitfield said, the Unix command dos2unix will help fix the problem. If you want more information, you can read the man pages for that command.