r instead of n when replacing ^M

I had the misfortune of working with a DOS-formatted CSV file where all the carriage returns were showing up as ^M in Vim.

I got as far as doing a search-and-replace:

:%s/^M/n/g

but all that did was give me ^@ wherever there used to be a ^M.

mpow figured out that all I needed a r (carriage return) instead of n (new line) in my search-and-replace command.

On a serendipitous note, I found an alternative method of getting non-printing ASCII characters such as ^M into my commands. The key sequence ^v^m will give you the ^M character! I no longer have to:

1. Open up my Vim command history buffer in…Vim.

2. Copy and paste the ^M character to form a command that I want to execute.

3. Save the command buffer and go into command mode.

4. Scroll through my command history and locate the newly-formed command.

5. Excecute the command.

According to SmartFTP, ^M are formed when ASCII files are transferred in binary mode, so the solution is to transfer them in ASCII mode.