Confirm line delete

情到浓时终转凉″ 提交于 2019-12-21 06:59:37

问题


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?


回答1:


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

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



回答2:


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


来源:https://stackoverflow.com/questions/6633496/confirm-line-delete

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!