Gentoo Archives: gentoo-user

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

Attachments

File name MIME type
signature.asc application/pgp-signature