我必须找到这些具有这种图案的话:Vim的正则表达式的查找和替换
File{some numeric characters}=
示例:File1=
,File234=
,File3456=
并将其删除。
这是该行:
File1=/media/sda5/
我现在已经来替换这一行:
/media/sda5/
由于我是新来的vim,所以,如果有人能帮助我
我必须找到这些具有这种图案的话:Vim的正则表达式的查找和替换
File{some numeric characters}=
示例:File1=
,File234=
,File3456=
并将其删除。
这是该行:
File1=/media/sda5/
我现在已经来替换这一行:
/media/sda5/
由于我是新来的vim,所以,如果有人能帮助我
这命令应该做你想做的事:
:%s/File\d\+=//g
:%s/ perform substitution on each line in the buffer
File\d\+= matches 'File' followed by one or more digits until the first '='
// deletes the matched text
g do that on every match on the line
可能重复[如何更改vim编辑器中的字符串?](http://stackoverflow.com/questions/13355809/how-to-change-a-string-in-the-vim-editor) – whoan 2014-11-23 16:45:16
': %s/^ File1 = \(/ media/sda5 \)/ \ 1/g' – 2014-11-23 16:57:17