I got a file with text in this format. (with unwanted line spaces)
1
2
3
Now I wanted to use vim to remove those unwanted lines with this command :%s/\n\n/\n/g
. replacing two new lines with one. But got this result:
1^@2^@3
then I found out about carriage return and used this post to change the command to :%s/\r\r/\r/g
and got this error saying E486: Pattern not found: \r\r
then I used this working command :%s/\n\n/\r/g
and got the desired result.
1
2
3
How is this working?