Article View: comp.unix.shell
Article #1211Re: changing a ! to a \nC where \n is a newline
From: David W. Tamkin
Date: Thu, 20 Sep 1990 21:32
Date: Thu, 20 Sep 1990 21:32
21 lines
1514 bytes
1514 bytes
coleman@cam.nist.gov (Sean Sheridan Coleman) said in <5015@alpha.cam.nist.gov>:
| I am trying to use the global substitution power in vi to
| replace every occurrence of ! with a newline and a C (\nC)
| Do you know how to make get vi to put a newline not a \n
| when doing the substitution?
That's been answered twice by now, both people suggesting :%s/!/^V^MC/g. Of
course, for a single substitution one can just put the cursor onto the ! and
type s<return>C<ESC>.
| How about the reverse, replace a newline with a character?
I can't think of a global way to do that, but JrC (where C is the character)
would do the trick. Start with the cursor on the line of text whose ending
newline you want to change. To change the newline to a string,
Js{string}<ESC>.
David Tamkin Box 7002 Des Plaines IL 60018-7002 708 518 6769 312 693 0591
MCI Mail: 426-1818 GEnie: D.W.TAMKIN CIS: 73720,1570 dattier@ddsw1.mcs.com
Technical Details
Message-ID:
<1990Sep20.213216.19049@ddsw1.MCS.COM>Path:
arc1-ca.pugleaf.net!utzoo!attcan!uunet!bu.edu!snorkelwacker!mintaka!olivea!orc!inews!iwarp.intel.com!gargoyle!ddsw1!dattierReferences:
<5015@alpha.cam.nist.gov>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!attcan!uunet!bu.edu!snorkelwacker!mintaka!olivea!orc!inews!iwarp.intel.com!gargoyle!ddsw1!dattier From: dattier@ddsw1.MCS.COM (David W. Tamkin) Newsgroups: comp.unix.shell Subject: Re: changing a ! to a \nC where \n is a newline Summary: one down, one to go Keywords: vi Message-ID: <1990Sep20.213216.19049@ddsw1.MCS.COM> Date: 20 Sep 90 21:32:16 GMT References: <5015@alpha.cam.nist.gov> Reply-To: dattier@ddsw1.MCS.COM (David W. Tamkin) Followup-To: comp.editors Organization: Contributor Account at ddsw1, Wheeling, Illinois Lines: 21