On 13 Jan 2007, Tim Chase wrote:
>I've imported a lot of files from a DOS word processor. >These have lots of control sequences of the form M-J ) New >lines I think). I can search for the M, which is Return, >but I don't see any way to get the -J. Is it possible?

IIUC, you have CR/LF pairs in the incoming file and want do do something to them?

Vim does some sniffing to detect the fileformat (":he 'ff'")...if they're all CR/LF pairs, the FF will come up as DOS. However, if there are some mismatched pairs in there, it often comes up as Unix format. It sounds like you're getting the latter format...that you're seeing Vim display the ^M (CR) and the ^J (LF) is interpreted as a line-break.

Thus, what you're looking for is

        :%s/\r\n/replacement


However, you may want to keep the original line breaks, in which case, you just want to use

        :%s/\r$/replacement

With a bit more information about what you're trying to do and what's in the file (are they paragraphs separated by double blank lines that you want to preserve? do the original line-breaks have significance to you?) you might have to modify this idea.

I'm not worried about the original line breaks. I think these controls were put in by the WP to be reformatable.ends of lines. But they don't seem to be ordinary CR/LF.

Anyway, the problem is that -J is not recognized as a control sequence by vim so I can't search for it or replace it. The best plan I've come up with so far is to search for ^M, find it, and do 2x to delete both ^M and the next character (i.e. -J). By putting this in a register I can repeat it a number of times.


This message has been scanned for viruses by BlackSpider MailControl - 
www.blackspider.com

Reply via email to