Find & Replace non-printable characters in vim

When I converted a file from EBCDIC format to ASCII format using an online tool, there are many non-printable characters in the ASCII file. So, this ASCII file is completely unreadable. So, I followed the below steps to make it readable.

1) Find hexa value of that non-printable character. Move your cursor to that character and press ‘ga’.

2) In escape mode, execute this ‘:%s/\%x85/\r/gc’. In my case, hexadecimal value of that non-printable character is 85. I replaced that with ‘\r’.

Some characters like ‘Ctrl+M’ can be printed by ‘Ctrl+v’ + ‘Ctrl+M’. But, in my case, 0x85 is that non-printable character and could not print it using ‘Ctrl+v’.

Advertisements