Blog is moving

My blog is moving to http://victormendonca.com/blog/. If you are looking for a specific or older post you are in the right place Otherwise check out my new page for more up to date content.

Tuesday, June 29, 2010

Removing Windows Newline (Control) Characters on VI

If you have to work on a Unix box trough Windows (putty or any other ssh utility), you most likely have encountered the problem where pasting a text trough putty will result on Windows control characters (^M) at the end of the lines. This is actually very easy to fix.

1- Open the text with VI (or VIM)
$ vi {file_name}

2- Now we need to get in command mode by pressing colon “:” on your keyboard
3- Type in the following code (note that you to get ^M you need to press “Ctrl+v” and then “Ctrl+m” on your keyboard):
%s/^M//g

4- Hit enter and you should be good to go!!


Related links:
http://en.wikipedia.org/wiki/Newline
http://www.cs.colostate.edu/helpdocs/vi.html

No comments: