如何在 vi 中替换 EOL 之前的文本?
我正在尝试在 vi
中进行替换搜索。通常:
:s/yes/no/gc
不合作。 “是”是该行的最后一段文字。如果我搜索的文本不是最后一个单词的一部分,则该命令有效。但以下各项似乎都不配合:
:s/ye/no/gc
:s/yesCTRLVCTRLM/noCTRLVCTRLM/gc
该文件是 DOS 格式 (EOL) 文件。
建议?
I'm trying to do a search in replace in vi
. The usual:
:s/yes/no/gc
isn't cooperating. The "yes" is the last piece of text on the line. If I search for text isn't part of the last word the command works. But none of the following seem to be cooperating:
:s/ye/no/gc
:s/yesCTRLVCTRLM/noCTRLVCTRLM/gc
The file is a DOS formated (EOL) file.
Suggestions?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
:s/yes$/no/gc 应该可以解决这个问题
$ 是代表行尾的字符。 ^ 代表行的开头。
:s/yes$/no/gc Should do the trick
$ is the character representing the end of the line. ^ would represent the start of the line.