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):

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

Related links:

No comments: