Sample vi Editing Session

This section describes a sample vi editing session. The file to be edited contains the following contents:

One fith
Two fish
Red fishes
Blue fish

When the file opens, vi is in Normal mode. Type the following editing commands:

/fith<Enter>
ftrs

The file now contains:

One fish
Two fish
Red fishes
Blue fish

Type the following commands:

2jlD        (l is lowercase L)

The file now contains:

One fish
Two fish
Red fish
Blue fish

Enter the following commands:

:1<Enter>
ddjp

The file now contains:

Two fish
Red fish
One fish
Blue fish

Get Spring Into Linux® now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.