Gentoo Archives: gentoo-user

From: R0b0t1 <r030t1@×××××.com>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] How do I turn off ansi (colour) codes in ... script output
Date: Sat, 03 Jun 2017 00:13:42
Message-Id: CAAD4mYgrV5JY0Yv8UPDmrX4NckAguPLD82SADn7+cbcfB2dKZQ@mail.gmail.com
In Reply to: Re: [gentoo-user] How do I turn off ansi (colour) codes in ... script output by R0b0t1
1 On Fri, Jun 2, 2017 at 7:12 PM, R0b0t1 <r030t1@×××××.com> wrote:
2 > On Fri, Jun 2, 2017 at 6:06 PM, Mick <michaelkintzios@×××××.com> wrote:
3 >> Hi All,
4 >>
5 >> Walter had posted a message about ANSI codes showing up in portage output. I
6 >> am getting the same when I run /usr/bin/script and examine the contents of the
7 >> resultant file with a text editor; e.g. in Vim I get:
8 >>
9 >> ^[[0;32m~ ^[[35m$ ^[[0mtest^H^[[K^H^[[K^H^[[K^H^[[Kecho S^H^[[K|^H^[[K$term^M
10 >>
11 >> but when I use less I can see:
12 >>
13 >> ~ $ echo $TERM
14 >>
15 >> Is there a way of suppressing these characters in gedit, kwrite, vim, etc.?
16 >> --
17 >> Regards,
18 >> Mick
19 >
20 > The proper way to approach this is to disable coloring in the program
21 > generating your output. If there is no flag for it, you can try
22 > setting your terminal capabilities such that color is not supported
23 > (e.g. TERM=xterm-old, possibly unsupported on BSDs). However for some
24 > poorly written programs that may not work. Lastly, you can strip the
25 > escape sequences from the output.
26 >
27 > See http://www.andre-simon.de/doku/ansifilter/en/ansifilter.php if you
28 > are interested in the latter option. This seems the easiest to do if
29 > you don't mind the extra step.
30
31 Apologies - you should also check your terminal emulator's
32 documentation to see if color escapes can be disabled as an
33 alternative to setting TERM, but this is probably the worst of the
34 three options.

Replies

Subject Author
Re: [gentoo-user] How do I turn off ansi (colour) codes in ... script output Mick <michaelkintzios@×××××.com>