changing a ! to a \nC where \n is a newline

Bob McGowen x4312 dept208 bob at wyse.wyse.com
Thu Sep 20 11:28:41 AEST 1990


In article <1990Sep18.023649.1336 at virtech.uucp> cpcahil at virtech.UUCP (Conor P. Cahill) writes:
  >In article <5015 at alpha.cam.nist.gov> coleman at 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/!/<ctrl>-V<Return>C/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 at wyse.com



More information about the Comp.unix.shell mailing list