hexdump indicates that the dot in .[16D is actually an escape character, \x1b .
Esc[ n D is an ANSI escape code to remove n characters. Therefore, Esc[16D tells the terminal to delete 16 characters, which explains the output of cat .
There are various ways to remove ANSI escape codes from a file using Bash commands (for example, using sed , as in Anubhava's answer) or Python.
However, in such cases, it might be better to run the file through the terminal emulator in order to interpret any existing editing control sequences in the file, so you will get the result that the file author intended after they applied these editing sequences.
One way to do this in Python is to use pyte , a Python module that implements a simple terminal emulator compatible with VTXXX. You can easily install it with pip , and here are its docs on readthedocs .
Here is a simple demo program that interprets the data asked in a question. It is written for Python 2, but easily adapts to Python 3. pyte is Unicode-aware, and its standard class Stream expects Unicode strings, but this example uses ByteStream, so I can pass it a regular byte string.
Output
HELLO
hex output dump
00000000 48 45 4c 4c 4f 0a |HELLO.|
source share