In vim editor, I want to replace a newline character (\n) with two new line characters (\n\n) using vim command mode.
Input file content:
This is my first line.
This is second line.
- Command that I tried:
But it replaces the string with unwanted characters as:%s/\n/\n\n/gThis is my first line.^@^@This is second line.^@^@ - Then I tried the following command
It is working properly.:%s/\n/\r\r/g
Can you explain why it is working fine with second command?