5.5 Replacing Text

   

In addition to inserting and deleting text, you can also replace existing text with new text. You can replace a single character or many lines of the text. The r command is used to replace a single character. When you press r while in command mode, nothing happens, but as soon as you press the next character, it appears on the screen replacing the character at the current cursor location. To replace one character and then go to insert mode, use the s command. You will see a $ symbol and vi will put you in the insert mode just after replacing the current character. You can also replace multiple characters with the R command. These and other replacement commands are listed in Table 5-4.

Table 5-4. Text Replacement Commands
Command Effect
r Replace current character remaining in command mode.
s Replace current character and go to insert mode.
R Replace multiple characters until the graphics/esc.gif key is pressed.
cw Change to the beginning of next word.
cc Change entire line.
cG Change to the end of file.

   
Top


HP Certified
HP Certified: HP-UX System Administration
ISBN: 0130183741
EAN: 2147483647
Year: 2000
Pages: 390
Authors: Rafeeq Rehman

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net