LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   vim remove line breaks (https://www.linuxquestions.org/questions/linux-newbie-8/vim-remove-line-breaks-757993/)

ColInvictus 09-26-2009 07:41 PM

vim remove line breaks
 
I've copied a bunch of text into vim and I need to get rid of the line breaks. I've tried
:%s/^M// (where ^M is C-v C-m)
and
:%s/.$//
and
:%s/\x0D$//
and
:%s/\$//

none of which work. If I issue
:set invlist

all lines are terminated with a '$'. How can I get rid of them?

Ta
Col

slakmagik 09-26-2009 08:21 PM

s/\n//

or the 'j' command on particular lines

ColInvictus 09-27-2009 05:16 AM

's/\n//'! I always miss the obvious ones... Thanks slakmagik

chrism01 09-27-2009 08:10 PM

Or run dos2unix <file> at the cmd line.


All times are GMT -5. The time now is 08:05 PM.