Vim note

来源:互联网 发布:光环国际 大数据 编辑:程序博客网 时间:2024/05/16 12:35

1.  :g/pattern/s/old/new

The first g tells the command to operate on all lines of a file. pattern identifies the lines
on which a substitution is to take place. On those lines containing pattern, ex is to
substitute (s) for old the characters

old could be regular expression


2.  :%s/old/new/g

% indentifies all lines

s substitudes command

"old" could be regular expression


0 0