syntax error near "^M"

I am creating config files in windows (using Wordpad or Notepad and saving as "file.extension") and ftp'ing them to my linux machine.  Sometimes when I restart my servers, I get the error in my /var/log/messages file as something like "syntax error near "^M" "(or something to that effect).  When I open the file in Linux, there is no "^M" in the file anywhere and I want to pull my hair out.  Is this a common error and is there really a "^M" there that I can't see?  I thought I was doing something wrong until I was reading some other questions posted and saw a similar problem someone was having.  Where does this hidden "^M" come from? I have a feeling that if I "pico file.extension" and re-save it in Linux it will work because I think I have unknowingly solved the problem before, I just haven't tried it this time yet.  Whatcha think?  Thanks in advance!
Who is Participating?
steve265Connect With a Mentor Commented:
^M is usually used to signify a return at the end of a line.
I would go to the file in question, go to the end of the last line of text and hold down the delete key for a few seconds. This will get rid of any ambiguous return characters.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.