Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!wuarchive!julius.cs.uiuc.edu!apple!vsi1!wyse!bob From: bob@wyse.wyse.com (Bob McGowen x4312 dept208) Newsgroups: comp.unix.shell Subject: Re: changing a ! to a \nC where \n is a newline Keywords: vi Message-ID: <2962@wyse.wyse.com> Date: 20 Sep 90 01:28:41 GMT References: <5015@alpha.cam.nist.gov> <1990Sep18.023649.1336@virtech.uucp> Sender: news@wyse.wyse.com Reply-To: bob@wyse.UUCP (Bob McGowen x4312 dept208) Organization: Wyse Technology Lines: 22 In article <1990Sep18.023649.1336@virtech.uucp> cpcahil@virtech.UUCP (Conor P. Cahill) writes: >In article <5015@alpha.cam.nist.gov> coleman@cam.nist.gov (Sean Sheridan Coleman X5672) writes: >>I am trying to use the global substitution power in vi to >>replace every occurrence of ! with a newline and a C (\nC) > >:1,$s/!/-VC/g (this will appear as:1,$s/!/^MC/g) > This will put carriage returns in the file, not newlines. My response to the posters question preceded this. The procedure is to go into full ex mode and use the backslash escape to input the newline: g/!/s//\ C/g Bob McGowan (standard disclaimer, these are my own ...) Product Support, Wyse Technology, San Jose, CA ..!uunet!wyse!bob bob@wyse.com