VI reference

http://blog.eddie.com.tw/2012/04/27/screencast-1-learning-vim-from-the-beginning/


http://www.ibm.com/developerworks/cn/linux/l-tip-prompt/tip15/


http://man.ddvip.com/soft/vieditor/vi.html


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:   n
  Repeat 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/g 

 Between two lines #,#:                 :#,#s/OLD/NEW/g
  
 Every occurrence in file:              :%s/OLD/NEW/g 

猜你喜欢

转载自blog.csdn.net/Andrew659/article/details/8160202
vi
今日推荐