Faster CR -> LF Macro?

AVKuznetsov kuzn at htsc.mephi.ru
Wed Mar 19 08:53:39 CET 2008


On Wed, 19 Mar 2008 01:44:58 -0500
Aaron Hsu <arcfide at mac.com> wrote:

> Hello All,
> 
> Do any of you have a faster way of doing a CR->LF conversion?
> 
> Right now I am using a macro. I want to be able to do this in one shot
> easily, because I do this a lot. Right now I have:
> 
> 	pos = search("\r", 0, "regex")
> 	while (pos >= 0) {
> 	  replace_range(pos, $search_end, "\n")
> 	  pos = search("\r", 0, "regex")
> 	}
> 
> This is a bit slow because it is running through a macro, so I was
> thinking about making it a script, but I don't know if that would be
> better or not. :-/ I mean, it's nice to have the macro going without
> having to have an external program to run it through.
> 
> Just wondering.

Hi,
try following ("regex" is excessive and may be slower)

replace_all("\r", "\n")
replace("\r", "\n" [, direction] [, wrap])
replace_in_selection("\r", "\n")

Alexey Kuznetsov


More information about the Discuss mailing list