On 06/03/2017 01:06 AM, Mick wrote: > Hi All, > > Walter had posted a message about ANSI codes showing up in portage output. I > am getting the same when I run /usr/bin/script and examine the contents of > the > resultant file with a text editor; e.g. in Vim I get: > > ^[[0;32m~ ^[[35m$ ^[[0mtest^H^[[K^H^[[K^H^[[K^H^[[Kecho S^H^[[K|^H^[[K$term^M > > but when I use less I can see: > > ~ $ echo $TERM > > Is there a way of suppressing these characters in gedit, kwrite, vim, etc.?
Well, one solution could be to use something like this : # strip away escape sequences # hint: colorstrip() doesn't modify its argument, instead it returns the result # function stresc() { perl -MTerm::ANSIColor=colorstrip -nle ' $_ = colorstrip($_); s,\r,\n,g; s/\x00/<0x00>/g; s/\x1b\x28\x42//g; s/\x1b\x5b\x4b//g; print; ' } This works fine here since a while -- Toralf PGP 23217DA7 9B888F45
signature.asc
Description: OpenPGP digital signature