Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re: Wanted: humanly readable `script` output

by repellent (Priest)
on May 08, 2008 at 08:11 UTC ( #685407=note: print w/ replies, xml ) Need Help??


in reply to Wanted: humanly readable `script` output

This is a best-effort to strip out most ANSI escape sequences:

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


Comment on Re: Wanted: humanly readable `script` output
Download Code
Re^2: Wanted: humanly readable `script` output
by Anonymous Monk on Mar 02, 2013 at 15:39 UTC

    Why, oh why do I always see people explaining away a tough problem as 'impossible to answer'? We're not discussing the halting problem or anything like that. I don't think it proper for monks (Perl or otherwise) to simply shrug off a tough problem as impossible to solve. Rather argue about it in order to find a solution (like Tibetan monks do, with great passion :-) )

    First: let's get the original poster's question and later clarification right: in simple terms of analogy: if you consider (scrolling) terminal output to be a movie of a special kind of printer which prints (and occasionally erases) text on the screen, and scrolling up the screen as feeding the (continuous feed) 'paper' out the top of the screen, then what he wants (and also what he doesn't need, e.g. full state recovery from every point in time) becomes very clear. The very fact that scrollback buffers exist and can be copied (although not very conveniently) corroberates this.

    That anology should put your mind on the right track: printer, paper...hardcopy!

    One simple Google session then quickly brings up the solution: use Gnu/screen for your session. Start it with $ screen -h <scrollback buffer size>. At the shell prompt that appears, type all the commands (including whatever typos / editing), then when you're done issue <Ctrl-A> :hardcopy -h <dumpfile>.

    That's it. You can use whatever full-screen application (vi(m), mc, emacs) you like inside the session, only the last screenful from that will be saved.

    More information here: http://www.samsarin.com/blog/2007/03/11/gnu-screen-working-with-the-scrollback-buffer/

      Why, oh why do I always see people explaining away a tough problem as 'impossible to answer'?

      Because you're hallucinating

        Must be the strong Tibetan mountain tea I drank this morning.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://685407]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (4)
As of 2014-10-26 09:54 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    For retirement, I am banking on:










    Results (153 votes), past polls