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

前端 未结 6 1682
青春惊慌失措
青春惊慌失措 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条回答
  •  温柔的废话
    2021-01-30 07:38

    Try this after saving your file in vim (assuming you are in Linux environment)

    :%!tr -cd '[:print:]\n'
    

提交回复
热议问题