Article View: comp.editors
Article #2665Re: map question
From: Tom Christiansen
Date: Thu, 16 May 1991 12:29
Date: Thu, 16 May 1991 12:29
26 lines
1378 bytes
1378 bytes
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."
Technical Details
Message-ID:
<1991May16.122907.26517@convex.com>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rpi!usc!cs.utexas.edu!sun-barr!newstop!central!convex!usenetReferences:
<1991May14.234859.3447@truevision.com>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rpi!usc!cs.utexas.edu!sun-barr!newstop!central!convex!usenet From: tchrist@convex.COM (Tom Christiansen) Newsgroups: comp.editors Subject: Re: map question Message-ID: <1991May16.122907.26517@convex.com> Date: 16 May 91 12:29:07 GMT References: <1991May14.234859.3447@truevision.com> Sender: usenet@convex.com (news access account) Reply-To: tchrist@convex.COM (Tom Christiansen) Organization: CONVEX Software Development, Richardson, TX Lines: 26 Nntp-Posting-Host: pixel.convex.com