changing a ! to a \nC where \n is a newline
David W. Tamkin
dattier at ddsw1.MCS.COM
Fri Sep 21 07:32:16 AEST 1990
coleman at cam.nist.gov (Sean Sheridan Coleman) said in <5015 at 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 at ddsw1.mcs.com
More information about the Comp.unix.shell
mailing list