我必须找到具有这种模式的单词:
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
关于linux - Vim 正则表达式查找和替换,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27091389/