Based on your comment, do this in vi
to remove additional control characters. I used to have this problem when editing files in gedit
or when editing on Windows, and then when using on a Unix / Linux computer.
To remove ^M
characters at the end of all lines in vi
, use:
:%s/^V^M//g
^v
is the Ctrl V character, and ^M
is Ctrl M. When you type this, it will look like this:
:%s/^M//g
On UNIX, you can escape the control character by surpassing it with Ctrl V. :%s
is the basic find and replace command in vi. He tells vi
to replace the regular expression between the first and second slashes ( ^M
) with the text between the second and third slashes (in this case, there is nothing). g
at the end directs vi
to search and replace worldwide (all occurrences).
A source
user195488
source share