Replace wth new line character in vi

In the replacement field, type ctrl+v+m (on screen, it looks like ^M); while in the search field, still use ‘\n’.

for example, replace all double new lines with a single new line

:s/\n\n/^M/g

Leave a Reply