On Fri, Jun 2, 2017 at 7:12 PM, R0b0t1 <r03...@gmail.com> wrote:
> On Fri, Jun 2, 2017 at 6:06 PM, Mick <michaelkintz...@gmail.com> 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.?
>> --
>> Regards,
>> Mick
>
> The proper way to approach this is to disable coloring in the program
> generating your output. If there is no flag for it, you can try
> setting your terminal capabilities such that color is not supported
> (e.g. TERM=xterm-old, possibly unsupported on BSDs). However for some
> poorly written programs that may not work. Lastly, you can strip the
> escape sequences from the output.
>
> See http://www.andre-simon.de/doku/ansifilter/en/ansifilter.php if you
> are interested in the latter option. This seems the easiest to do if
> you don't mind the extra step.

Apologies - you should also check your terminal emulator's
documentation to see if color escapes can be disabled as an
alternative to setting TERM, but this is probably the worst of the
three options.

Reply via email to