remove new line and bring next line up

vu pham vu at sivell.com
Fri Apr 9 18:53:44 PDT 2010


On 04/09/2010 03:16 PM, Brad De Vries wrote:
> 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.

Thanks, Brad. This is what I need. Learned something new today :)

Vu



More information about the Linux-users mailing list