我正在使用 CentOS,并且正在阅读有关编辑器中的替换命令 ,s///
的信息vi
。我想测试一些我看到的例子:
:%s/old/new/g Substitutes old with new throughout the file
:.,$s/old/new/g Substitutes old with new from the current cursor position to the end of the file
Run Code Online (Sandbox Code Playgroud)
上面的示例对我来说按预期工作,但以下包含插入符号 ( ^
) 的示例不起作用:
:^,.s/old/new/g Substitutes old with new from the beginning of the file to the current cursor position
Run Code Online (Sandbox Code Playgroud)
我试过了,但没有用,所以插入符号不起作用还是我输入的命令不正确?