Ny way to convert a putty “All session output” log, with control characters, to a more human readable “Printable output” log

commandcommand-line-interfaceputty

We had a contractor in-house to help with some configuration of a product and we're trying to look through the putty logs he set up for us, but instead of using "printable output" he used "all session output" which includes every keystroke including "BS", etc. making the logs very difficult to read as he had many, many typos. ie:

[ESC]]0;root@host:~[BEL][root@host ~]# itm,cm[BS][BS][ESC][K[BS][ESC][Kcmd agent starp[BS]t

Is there some way to strip these control characters out, intelligently, so that the end result is a human readable file much like what you'd see in "printable output" format?

Thank you for the below suggestion. Our major painpoint is the [BS] control characters, which would turn this:

ls -pg[BS][BS]al P[BS]| greu[BS]p dr

into:

ls -al | grep dr

Any idea how that could be accomplished?

Best Answer

Enable a very large scrollback in putty, cat the log file, and copy and paste the result into a new file.