Skip to main content
Giving more details on answer
Source Link

ThisI would prefer to use specialized tools to convert script output into plain text, which is constantly supported and well tested, over custom regexp. So this did job for me:

$ cat typescript | ansi2txt | col -bp > typescript.txt.bp $ cat -v typescript.txt.bp 

script command captures into typescript file ansi2txt - converts ansi code with escapes like colorcodes, backspaces etc into regular text, however I found that couple escapes still left. col -bp - removed them completely.

I’ve tested this on latest Ubuntu disco, and it works.

This did job for me:

$ cat typescript | ansi2txt | col -bp > typescript.txt.bp $ cat -v typescript.txt.bp 

script command captures into typescript file ansi2txt - converts ansi code with escapes like colorcodes, backspaces etc into regular text, however I found that couple escapes still left. col -bp - removed them completely.

I’ve tested this on latest Ubuntu disco, and it works.

I would prefer to use specialized tools to convert script output into plain text, which is constantly supported and well tested, over custom regexp. So this did job for me:

$ cat typescript | ansi2txt | col -bp > typescript.txt.bp $ cat -v typescript.txt.bp 

script command captures into typescript file ansi2txt - converts ansi code with escapes like colorcodes, backspaces etc into regular text, however I found that couple escapes still left. col -bp - removed them completely.

I’ve tested this on latest Ubuntu disco, and it works.

This did job for me:

$ cat typescript | ansi2txt | col -bp > typescript.txt.bp $ cat -v typescript.txt.bp 

script command captures into typescript file ansi2txt - converts ansi code with escapes like colorcodes, backspaces etc into regular text, however I found that couple escapes still left. col -bp - removed them completely.

I’ve tested this on latest Ubuntu disco, and it works.

This did job for me:

$ cat typescript | ansi2txt | col -bp > typescript.txt.bp $ cat -v typescript.txt.bp 

This did job for me:

$ cat typescript | ansi2txt | col -bp > typescript.txt.bp $ cat -v typescript.txt.bp 

script command captures into typescript file ansi2txt - converts ansi code with escapes like colorcodes, backspaces etc into regular text, however I found that couple escapes still left. col -bp - removed them completely.

I’ve tested this on latest Ubuntu disco, and it works.

added 2 characters in body
Source Link
slm
  • 380.1k
  • 127
  • 793
  • 897

This did job for me:

$ cat typescript | ansi2txt | col -bp > typescript.txt.bp    $ cat -v typescript.txt.bp 

This did job for me

cat typescript | ansi2txt | col -bp > typescript.txt.bp   cat -v typescript.txt.bp 

This did job for me:

$ cat typescript | ansi2txt | col -bp > typescript.txt.bp  $ cat -v typescript.txt.bp 
Source Link
Loading