Searching and Replacing in vi

One of vi’s better features (and advantages over pico) is that it allows you to search and replace throughout entire files. As shown in the next sections, you can just find a specific string of text (a regular expression, in Unix lingo; see Figure 4.14), or you can find the text and replace it with other text, as in Figure 4.15.

Figure 4.14. Searching for text in vi is quick and reliable.
Figure 4.15. Replacing text in vi requires a bit of arcane syntax, but you get used to it quickly.

To Find a String of Text in vi:

1.
vi hairyspider For starters, access vi and ...

Get Unix Third Edition: Visual Quickstart Guide 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.