[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Q: 'outputting' manpages



Sven Burgener <svenb@bluewin.ch> writes:
> ** Now I have a question: **
> 
> How do I properly print out the contents of a manpage?
> When I do ":r! man blabla" in vi, I get funny characters at some places.
> 
> Using man's --ascii option didn't help.

If you really want to print the contents:

  groff -mandoc -s -t -Tps foo.1 > foo.ps

If you want the contents of the file as marked up text:

  man foo > foo.out

or, equivalently

  groff -mandoc -s -t -Tascii foo.1 > foo.txt

This however has some problems as you found out.  The reason is that
the output has backspace characters which many pagers use to show bold
and underlined characters.  For example, to make the pager show a bold
'x', the output of 'man' would be 'x^Hx', and an underlined 'x' would
be output as '_^Hx'.  The pagers interpret these and show bold and
underlined characters.

You can tell the output generator not to output the "overstrike"
characters.  Here's how:

  groff -mandoc -t -s -Tascii -P-u -P-b -P-o foo.1 > foo.txt
                             ^^^^^^^^^^^^^^^^

- Hari
-- 
Raja R Harinath ------------------------------ harinath@cs.umn.edu
"When all else fails, read the instructions."      -- Cahn's Axiom
"Our policy is, when in doubt, do the right thing."   -- Roy L Ash



Reply to: