[clug] Cleaning up a "script" file

Brett Worth brett.worth at gmail.com
Wed Mar 24 23:36:48 UTC 2021


Morning all.

I use the "script" command to capture the output of sessions for reference and have been 
doing so for years. One thing that's always been a problem is that script just captures 
the literal stream of characters that's being sent out from the tty so all escape 
sequences appear in the output file.

I've googled a bit and there's a lot of talk about using perl or sed to strip out the 
^[[37m   etc. sequences but I'm looking for something better.

What would be very useful would be something that would interpret the controls. e.g.

$ ls fred^H^H^H^Hbloggs

would just display

$ ls bloggs

in the output file while perhaps just removing the colour selection commands.  I use "vi" 
command line editing which always ends up looking like a dog's breakfast in the script 
output file.

Does such a thing already exist? (before I waste time trying to do it myself)

Brett

-- 
--  /) _ _ _/_/ / / /__ _ _//
-- /_)/</= / / (_(_//_//< ///




More information about the linux mailing list