Article From:https://www.cnblogs.com/baxianhua/p/9062386.html

Knock the commands in the following order

①vim filename

②e

③i

④ESC

 

1    :s/str1/str2    Replace the first STR1 of the current line to STR2

2    :s/str1/str2/g    Replace all the STR1 of the current line to STR2

 

3    :n,$s/str1/str2/ Replace the first STR1 from line n to the last row to STR2.

 

4    n,$s/str1/str2/g

 

Similar Posts:

Link of this Article: Linux command: replace string

Leave a Reply

Your email address will not be published. Required fields are marked *