[comp.editors] map question

jerrys@truevision.com (Jerry Schwartz) (05/15/91)

How can I delete all the control-M's (^M) from
a file with a map function?

This is what I have tried but it doesn't seem to work.

:map m :1,$s/\^V^M//g^V^M
"       Press m to get rid of crtl-M's in file

I use a similiar macro for the followinf function
and it works.

:map z :.,$s/_\^V^H//g^V^M
"       Press z to .,$s/_^H//g
"       used to remove _^H in man pages sent to a file

What's the difference???


Jerry Schwartz
jjs@epicb.truevision.com

wyle@inf.ethz.ch (Mitchell Wyle) (05/15/91)

In <1991May14.234859.3447@truevision.com> 
jerrys@truevision.com (Jerry Schwartz) asks:

>How can I delete all the control-M's (^M) from
>a file with a map function?

map m :%s/^V^M//g^V^M

works on Sun-OS 4.1.1

-Mitch

tchrist@convex.COM (Tom Christiansen) (05/16/91)

From the keyboard of jerrys@truevision.com (Jerry Schwartz):
:How can I delete all the control-M's (^M) from
:a file with a map function?
:
:This is what I have tried but it doesn't seem to work.
:
::map m :1,$s/\^V^M//g^V^M
:"       Press m to get rid of crtl-M's in file

Escaping control-V's doesn't work: to quote tty chars, use ^V.
To quote magic chars (*.[) use \.

This works when put in a .exrc:

map m :1,$s/^V^V^M//g^M
"       Press m to get rid of crtl-M's in file

(Of course, you have to put in real control characters, not caret stuff:
    perl -pe 's/\^(.)/sprintf("%c",ord($1) ^ 0x40)/ge' 
 will convert it for you (and only screws up with non-control ^'s, that
 I don't have in this message.)

--tom
--
Tom Christiansen		tchrist@convex.com	convex!tchrist
		"So much mail, so little time."