Global and Partial Text Substitution

vi has a built-in colon command g to globally search for and replace all occurrences of one pattern with another. You learned how to use sed and awk in the previous chapters; however, this next section shows you how to use other UNIX commands to modify your whole file or any part of your file. After you learn this technique, you can do much more than the global g command can do.

Substituting Regular Expressions Patterns Throughout the File

How to globally replace a pattern in your document

Why Not Use the Built-in vi Replacement Commands?

vi supports two built-in colon commands: g (global) and s (substitution, which aren’t covered in this book because calling the external sed command fills the same function ...

Get Practical UNIX 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.