Remove CTRL-M characters from a file in UNIX
1) Open the file in vi
2) Type the following
3) Press enter
to the ^M you have to type CTRL+V and then CTRL+M
How do I make the vi editor display or hide line numbers?
To make vi display line numbers, you need to set the number flag.
Press the Esc key if you are currently in insert or append mode.
Press : (the colon). The cursor should reappear at the lower left corner of the screen next to a : prompt.
Enter the command: set number
To turn off line numbering, again follow the preceding instructions, except this time enter set nonumber the : prompt:
When porting a text file from Windows to UNIX you will quite often get a ^M on the end of every line. Apart from look bad and make it hard to read, if you text file happens to be a script, then this can also effect the way your script is run.
To remove the ^M characters at the end of all lines in vi, use this command.
To get the ^V you need to type Control+V and Control+M for the ^M. However when you type this, it will appear on the screen like this:
Continue reading Removing ^M characters in VI