3

I have run some commands in gnu screen and used the C-a H command to record the output to a screenlog.0 file. However now I want to view it. There are loads of terminal escape sequences, so just cat-ing it will show me everything all at once.

I know there is no timing informating in this file, and that's fine. But is it possible to some how incrementally reply the file? One character/escape sequence at a time? Is there any command that will take a file like this and only "print" each character/escape sequence one at a time while I press buttons / allow me to step ahead?

UPDATE: If I use less or more, I can see the file and see things, but that shows me the raw contents, including control codes. If I half entered a command and pressed tab, it shows the tab key. So I can't copy/paste

2 Answers 2

3

You could use a pager like less or more:

less screenlog.0

Or

more screenlog.0

Not sure what terminal escape codes you have but if they are not displayed correctly, use

less -R screenlog.0
2
  • 1
    Hi and welcome to the site. I edited your answer to make it more informative. We like answers to explain how a suggested tool would be used to solve the issue described.
    – terdon
    Oct 14, 2014 at 10:40
  • less & more do allow you to see the file, which is OK, but not exactly what I want. less shows me all the escape codes, so I can't copy paste in or out of the file Oct 14, 2014 at 11:45
0

Here is a simple POC Bash script to replay screenlog.0 while one can change the replay speed by pressing 0, 1, ... 9 where 0 means full speed. Press space to pause/resume.

exec 6< screenlog.0
sleep=2 # initial speed where 2 means 0.2s pauses between "lines"
while read -r line <&6 ; do
  printf '%b\n' "$line"
  read -s -N 1 -t .$sleep
  case "$REPLY" in [0-9]) sleep="$REPLY";; " ") read -s -d " ";; esac
done

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .