5

I like to use the 'script' command to record console sessions. The problem is that the 'typescript' file which is created contains control chars (when using arrows or the delete key).

Apart from editing the file manually, is there a way to generate a file which contains what we see in the file when we cat or more it?

Any attempt with cat, more, less -R, tr, pr ends with a file that displays well, but still contains the control chars.

Gareth
  • 19,080
Gra
  • 155

3 Answers3

2

Try with:

less -r typescript

From man less:

-r or --raw-control-chars
       Causes "raw" control characters to be displayed.  The default is
       to  display  control  characters  using  the caret notation; for
       example, a control-A (octal 001) is displayed as "^A".  Warning:
       when the -r option is used, less cannot keep track of the actual
       appearance of the screen (since this depends on how  the  screen
       responds to each type of control character).  Thus, various dis‐
       play problems may result, such as long lines being split in  the
       wrong place.
cYrus
  • 22,335
2

See "script-declutter" at http://jdimpson.livejournal.com/7040.html

0

I posted my solution, which basically automates running scriptreplay in screen and dumping the scrollbackbuffer here:
https://stackoverflow.com/a/28088786/4482549
It shows only what was send and received on terminal, not the editing.