remove new line and bring next line up

Brad De Vries devriesbj at gmail.com
Fri Apr 9 13:16:50 PDT 2010


On Fri, Apr 9, 2010 at 3:09 PM, Vu Pham <vu at sivell.com> wrote:
> In vi, I use J at the end of a line to move the next line up next to the
> current line. How can I do it over many lines by one or two commands ?
>
> What I want is to convert
>
> a,
> b,
> c,
> d,
> e
>
> to a,b,c,d,e
>
>
> I tried
> :n,m s/control-VcontrolJ//g
> but it fails.
>
> Thanks,
> Vu

Have you tried:
  5J

This will join the five lines into one but it will put a space between
each letter.  You'd then have to replace the space with a comma:
  :s/ /,/g

HTH,
Brad.



More information about the Linux-users mailing list