Deleting text



Last revision August 2, 2004

Table of Contents:
  1. Editor choices on Unix
  2. Characteristics, advantages, and disadvantages of vi
  3. Basic text editing operations in vi
  4. Regular expressions
  5. File searching with grep
  6. More about regular expressions
  7. Intermediate text editing with vi
  8. Vi Quick Reference

Use the x command to remove single characters. Position the cursor over the character to be removed and press the x key. Preceding x with a numeric value removes that many characters; for example, 5x removes five characters starting at the cursor position.

Use r to replace a single character. Position the cursor where you want to make the replacement, then type r followed by the new character.

To remove the entire line that the cursor is on, type dd. Precede this with a numeric count to remove multiple lines; for example, 12dd removes the next twelve lines starting with the one the cursor is on.

Comments or Questions?