How to filter only printable characters in a file on Bash (linux) or Python? -
i want make file including non-printable characters include printable characters. think problem related acscii control action , not find solution , not understand meaning of .[16d (ascii control action character??) in following file. hexdump of input file: 00000000: 4845 4c4c 4f20 5448 4953 2049 5320 5448 hello th 00000010: 4520 5445 5354 1b5b 3136 4420 2020 2020 e test.[16d 00000020: 2020 2020 2020 2020 2020 201b 5b31 3644 .[16d 00000030: 2020 when cat ed file on bash , got: "hello ". think because default cat interprets ascii control action, 2 .[16d s. why 2 .[16d strings make cat file print "hello"?, and... how can make file include printable characters, i.e., "hello "? the hexdump shows dot in .[16d escape character, \x1b . esc[ n d ansi escape code delete n characters. esc[16d tells terminal delete 16 characters, explains cat output. there various ways remove ansi escape codes file, either using bash comm...