How do I replace or find non-printable characters in vim regex?

前端 未结 6 1691
青春惊慌失措
青春惊慌失措 2021-01-30 07:09

I have a file with some non-printable characters that come up as ^C or ^B, I want to find and replace those characters, how do I go about doing that?

6条回答
  •  旧时难觅i
    2021-01-30 07:35

    You can use:

    :%s/^C//g
    

    To get the ^C hold the control key, press V then C (Both while holding the control key) and the ^C will appear. This will find all occurrences and replace them with nothing.

    To remove both ^C and ^B you can do:

    :%s/^C\|^B//g
    

提交回复
热议问题