简体   繁体   中英

Delete all occurrences of double backslash

How do I delete all occurrences of \\\\ from cursor position to the end of file?

What I tried:

:%s/\\\\//g deletes single \\ and in all the file.

:g#\\\\#$d does not really work.

Try :.,$s/\\\\\\\\//g

  • The first \\ will escape the second \\ , so you need to use 4 to get 2 literal backslashes.
  • Thanks to this SO answer , I learned that the % in :%s is shorthand for 1,$ (or the first line, to the end of the file). If we change this to .,$ , our substitution will run from the current position to the end of the file.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM