You can use commands to quickly Replace text when editing files using vi. The following describes some of its modes.
Replace the first OLD value of the current row with NEW: s/OLD/NEW, and replace the OLD value with NEW: s/OLD/NEW. replace all OLD values in the current file with NEW: % s/OLD/NEW/g
In addition to the above replacement modes, you can also specify two row numbers and replace all the OLD values between them with the NEW ones,
The syntax is: the first # indicates the start line, and the second # indicates the end line: #, # s/OLD/NEW/g replaces the OLD from the third row to the fifth row with NEW: 3, 5S/OLD/NEW/g where two rows can also appear only one, omitted that represents the row where the cursor is located, for example ::, 5S/OLD/NEW/g replace all OLD with NEW: 5, s/OLD/NEW/g replace all the OLD rows from row 5th to the row where the cursor is located with NEW. In addition, the last row can be represented by $. Therefore, % s/OLD/NEW/g is equivalent: 1, $ s/OLD/NEW/g