mikixiyou 发表于 2013-1-31 00:51:21

vi工具的常用命令之查找和替换

vi工具的常用命令


Vi: Search and Replace




Change to normal mode with <ESC>.
Search (Wraped around at end of file):
Search STRING forward :   / STRING.Search STRING backward:   ? STRING.Repeat search:   nRepeat search in opposite direction:N(SHIFT-n)
Replace: Same as with sed,Replace OLD with NEW:
First occurrence on current line:      :s/OLD/NEW   Globally (all) on current line:      :s/OLD/NEW/gBetween two lines #,#:               :#,#s/OLD/NEW/g   Every occurrence in file:            :%s/OLD/NEW/g
页: [1]
查看完整版本: vi工具的常用命令之查找和替换