Vi question

Mark Marsh mark at siva.UUCP
Sun Jun 17 06:31:17 AEST 1990


In article <13132 at ulysses.att.com> mab at ulysses.att.com (Muhammad Basit) writes:
>I have a simple vi question. How do I substitute a character with the
>newline character in vi? I tried '\n', '\\n', the ascii code etc but
>it doesn't seem to work. 

When substituting a non-printing (ie control-character) into text in vi
the following sequence may be used:

s/<initial pattern>/[Ctrl-v]<non-printing character/

Example: 
To insert a newline character into the string "12345" after '3' then use:

s/12345/123[Crtl-v][Enter]45/

Note that in this example that text inside the square ([]) brackets 
indicate a keystroke
(ie [Enter] is pressing the Enter key, and [Ctrl-v] is holding down
the Control key, and while it is depressed, type the  v  key.)

-- 
mark at siva -or- {ames!pacbell!sactoh0}||{ucbvax!ucdavis!csusac!unify}!siva!mark
"But, I only did what you didn't tell me not to do!"             _Users Credo_



More information about the Comp.unix.questions mailing list