在 VIM 中搜索包含大量斜杠和点的文件时遇到问题

发布于 2025-01-05 02:51:42 字数 359 浏览 1 评论 0原文

我有一堆非常大的文件,其中包含以下行:

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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

生寂 2025-01-12 02:51:42

您需要一个反斜杠来转义点或斜杠:

/\.\/1861\/

You need a backslash to escape the dot or the slash:

/\.\/1861\/
梦魇绽荼蘼 2025-01-12 02:51:42

使用 ? 向后搜索。这意味着您不需要转义 /

?/1861/

Use ? to search backwards. This means you don't need to escape the /s.

?/1861/
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文