O'Reilly logo

Practical UNIX by Steve Moritsugu - DTR Business Systems

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required