On Wed, Dec 14, 2011 at 02:01:43AM +0100, Kristaps Dzonsons wrote: > >I wanted to grep a pattern from a manpage and was > >very surprised I do not get "normal" plain text. > > > >$ mandoc /usr/local/man/man1/context.1 | cat -ntve | sed -n '123,124p' > > 123 -^H--^H-v^Hve^Her^Hrs^Hsi^Hio^Hon^Hn$ > > 124 report installed context version$ > > > >karl.example.com (00:44:27) > >karl(ttyp3) [/tmp] > >$ mandoc /usr/local/man/man1/context.1 | grep version > > version of the ConTeXt typesetting system, an extensive macro package > > report installed context version > > > >Is this expected behaviour? I really don't understand much > >'ASCII Output' section of mandoc manpage. > > Hi Jiri, > > This is documented in the mandoc manual under the "ASCII Output" section. > > Font styles are applied by using back-spaced encoding such that > an underlined character `c' is rendered as `_\[bs]c', where > `\[bs]' is the back-space character number 8. Emboldened > characters are rendered as `c\[bs]c'. > > In other words, line 123 is in boldface (the backspace \b is > rendered as ^H by cat(1)). In the second example, the output is not > decorated, thus it has no escapes. You probably want: > > $ mandoc context.1 | col -b | cat -ntve | ...
Thank you guys! It works great. jirib

