How to implement batch replacement in vi

To replace all characters a in the file tihuan (assuming character a in this text) with characters w, the command is:
1. vi tihuan
2. Press esc key
3. Press shift +:
4. After: enter% s / a / w / g

Where s is: substitute,% means all rows, g means global

If you want to replace the line between 34 and 78, it is as follows: the
previous steps are the same as above, the last step is
: 34, 78s / a / w /

 

Published 42 original articles · Like 10 · Visitors 10,000+

Guess you like

Origin blog.csdn.net/qq_37659294/article/details/102152134