In unix the end of line is different than other systems. More times we edit windows files and when open in VI/VIM we see the ^M character at end of lines.

We can remove this characters with a simply search and replace of vim with this command:

:%s/^M//g

The ^M character is not valid write first ^ character and then M it's not the valid character. To write correctly this we must push Control+v and Contro+M keys, then appear our ^M Character.

Take care with this.