确认行删除

发布于 2024-11-19 08:22:20 字数 132 浏览 7 评论 0原文

我创建了一个函数来搜索文件中的所有双行。

我使用“行号”g/.*/d 来删除该行。

不过我想确认是否需要删除一行, 像s/..//gc命令

是否可以用全局或替换删除某一行
命令并确认每一个动作?

I have created a function to search all double lines in a file.

I use the "line-number"g/.*/d to delete the line.

However I would like to confirm if a line has to be deleted or not,
like the s/..//gc command

Is it possible to delete a certain line with the global or substitute
command and confirm every action?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(2

2024-11-26 08:22:20

为什么不尝试使用替代命令而不是删除命令呢?

"line-number"s/^.*$\n//c

Why not try a substitute command instead of the delete command?

"line-number"s/^.*$\n//c
人间☆小暴躁 2024-11-26 08:22:20

如果我想删除文件中的行并确认每一行,我会:

  • 搜索第一行
  • ,如果我想删除它,按 dd
  • 使用 n 搜索下一行code>
  • 如果我想删除它,请按 .,否则再次按 n

If I wanted to delete lines in a file and confirm each one, I would:

  • search for the first one
  • if I want to delete it, press dd
  • search for the next one with n
  • if I want to delete that, press ., else n again
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文