If I have to replace newlines with comma for all lines between Pattern 1 and Pattern 2, how do I do it?
From:
Pattern 1
abcd
edfgads asd
adsad
...
Pattern 2
to:
Pattern 1, abcd, edfgads asd, adsad, ..., Pattern 2
For vim it would be
:%s/\n/, /g
You search for a newline character: \n
and replace it with comma and space: ,
which is done globally g
, these options are split by /
character.
More info about replace in vim you can find here
How about
Search
The replace part should be clear without an explanation.