在 VIM 中搜索包含大量斜杠和点的文件时遇到问题
我有一堆非常大的文件,其中包含以下行:
convert ./1776/07/04/T915002.tif ./1776/07/04/T915002.png rm ./1776/07/04/T915002.tif convert ./1776/07/04/T918012.tif ./1776/07/04/T918012.png rm ./1776/07/04/T918012.tif
我想做的是搜索 /1861/ 意味着 1861 年的一行 但 vim 似乎解释为“转到第 1861 行”,这根本不是我想要的。
搜索 ./1861/ 也失败。我假设前导点试图匹配任何字符。尝试反斜杠引用也失败了。显然我错过了一两个基本想法。
谢谢
I've got a bunch of really big files that contain lines like:
convert ./1776/07/04/T915002.tif ./1776/07/04/T915002.png rm ./1776/07/04/T915002.tif convert ./1776/07/04/T918012.tif ./1776/07/04/T918012.png rm ./1776/07/04/T918012.tif
What I want to do is search for say /1861/ meaning a line for the year 1861
But vim seems to interpret that 'go to line 1861, which is not at all what I want.
Searching for the ./1861/ fails too. I assume the leading dot tried to match any character. Trying to backslash quote it fails too. Clearly I'm missing a fundamental idea or two.
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您需要一个反斜杠来转义点或斜杠:
You need a backslash to escape the dot or the slash:
使用
?
向后搜索。这意味着您不需要转义/
。Use
?
to search backwards. This means you don't need to escape the/
s.