Can I programmatically “burn in” ANSI control codes to a file using unix utils?

To display a file that contains ANSI sequences, less -r typescript Or, less -R typescript To remove ANSI and backspace sequences from a file, creating a clean newfile, try: sed -r ‘:again; s/[^\x08]\x08\x1b\[K//; t again; s/\x1b_[^\x1b]*\x1b[\]//g; s/\x1B\[[^m]*m//g’ typescript >newfile How it works -r This turns on extended regular expressions. (On BSD systems, -r should be … Read more