Tag Info

Hot answers tagged

19

The following script should filter out all ANSI/VT100/xterm control sequences for (based on ctlseqs). Minimally tested, please report any under- or over-match. #!/usr/bin/env perl while (<>) { s/ \e[ #%()*+\-.\/]. | (?:\e\[|\x9b) [ -?]* [@-~] | # CSI ... Cmd (?:\e\]|\x9d) .*? (?:\e\\|[\a\x9c]) | # OSC ... (ST|BEL) ...


16

Updating Gilles' answer to also remove carriage returns and do backspace-erasing of previous characters, which were both important to me for a typescript generated on Cygwin: #!/usr/bin/perl while (<>) { s/ \e[ #%()*+\-.\/]. | \r | # Remove extra carriage returns also (?:\e\[|\x9b) [ -?]* [@-~] | # CSI ... Cmd (?:\e\]|\x9d) ...


6

You can playback your typescript capture and encode the corresponding screen region using something like: ffmpeg -y -f x11grab -s 100x100 -i :0.0+100,100 -pix_fmt rgb24 -r 5 Desktop/capture.gif -y overwrites the output (most useful when testing) -f x11grab forces the format to x11grab -s 100x100 captured video is 100x100 -i :0.0+100,100 top left corner ...


5

Maybe with: if lsof -tac script "$(tty)" > /dev/null; then echo "I'm running under script" else echo "I'm not" fi You could add something like: lsof -tac script "$(tty)" > /dev/null && PS1="[script] $PS1" To your ~/.zshrc or ~/.bashrc, so the information on whether you're in script or not would be visible on your shell prompt. ...


5

Untested: record with ttyrec, and convert with tty2gif.


4

I would use sed in this case. do: cat -v typescript | sed -e "s/\x1b\[.\{1,5\}m//g" sed -e "s/search/replace/g" is standard stuff. the regex is explained as below: \x1b match the Escape preceeding the color code \[ matches the first open bracket .\{1,5\} matches 1 to 5 of any single character. Have to \ the curly braces to keep the shell from mangling ...


4

Interesting problem. I found a small bash script could do the job pretty reliably: #!/bin/bash PP=$(ps -o ppid= $$) while [[ $PP != 1 ]] do LINE=$(ps -o ppid= -o comm= $PP | sed 's/^ *//') COMM=${LINE#* } PP=${LINE%% *} if [[ $COMM == script ]] # Might need a different comparison then echo "In script" exit 0 fi ...


4

I couldn't get tty2gif to work right with vim. So I hacked together ttygif.


3

most easy way to share typescript is http://shelr.tv/ It uses script or ttyrec as backend and you can puslish your typescript as easy as "shelr push last" :)


2

# The "sed -r" trick does not work on every Linux, I still dunno why: DECOLORIZE='eval sed "s,${END}\[[0-9;]*[m|K],,g"' => howto use: <commands that type colored output> | ${DECOLORIZE} tested on: - AIX 5.x / 6.1 / 7.1 - Linux Mandrake / Mandriva / SLES / Fedora - SunOS


2

cat typescript | perl -pe 's/\e([^\[\]]|\[.*?[a-zA-Z]|\].*?\a)//g' | col -b > typescript-processed


1

http://shelr.tv/ is what you need. It allows you to publish typescripts and replay them locally or on the web. It uses script or ttyrec (when script is broken like on Macs or BSD) internally.


1

I solved the problem by running scriptreplay in a screen and the dumping the scrollback buffer to a file. The following expect script does this for you. It has been tested for logfiles with up to 250.000 lines. In the working directory you need your scriptlog, a file called "time" with 10.000.000 times the line "1 10" in it, and the script. I needs the ...



Only top voted, non community-wiki answers of a minimum length are eligible