Re: [gentoo-user] How to get plain ascii from man?
On Wed, Mar 25, 2009 at 10:12:20PM +, Grant Edwards wrote How do you get a plain ascii file (no backspacing, no escape sequences) out of man? Running it through col or colcrt doesn't work anymore, because the default output contains ANSI color escape sequences. I done it! And no, the following man2text script is not brought to you via an uncorrected dialup modemg. #!/bin/bash sed s/^[\[[^m]\+m//g *IMPORTANT* the 8th and 9th columns of the second line are *NOT* ^[. That's actually the escape character as displayed in vim. In vim in entry mode, you can insert control character by prefixing them with CTRL-V. To enter the escape character, press CTRL-V and release, then press escape. Here's the logic - You want to get rid of all ANSI terminal sequences - all ANSI terminal sequences start with escape[, have 1 or more mode characters, and finish off with m - the sed one-liner deletes all such occurences (technically, it replaces them with nothing). -- Walter Dnes waltd...@waltdnes.org
[gentoo-user] How to get plain ascii from man?
How do you get a plain ascii file (no backspacing, no escape sequences) out of man? Running it through col or colcrt doesn't work anymore, because the default output contains ANSI color escape sequences. grotty apparently outputs ANSI color escape sequences regardless of whether or not the output is a tty and regardless of the TERM setting. Who decided that everyting in the friggin' world was an ANSI color crt even if it's not a tty and TERM isn't set? -- Grant Edwards grante Yow! Am I SHOPLIFTING? at visi.com
Re: [gentoo-user] How to get plain ascii from man?
On Wed, Mar 25, 2009 at 5:12 PM, Grant Edwards gra...@visi.com wrote: How do you get a plain ascii file (no backspacing, no escape sequences) out of man? Running it through col or colcrt doesn't work anymore, because the default output contains ANSI color escape sequences. grotty apparently outputs ANSI color escape sequences regardless of whether or not the output is a tty and regardless of the TERM setting. Who decided that everyting in the friggin' world was an ANSI color crt even if it's not a tty and TERM isn't set? Edit /etc/man.conf and add -c to the commandline for TROFF, NROFF and JNROFF. Then man program | col -bf or your method of choice should work. There is a note in the man.conf comments about it.