printing out manual pages

Joe English jeenglis at alcor.usc.edu
Mon Apr 29 18:31:55 AEST 1991


c60b-1eq at e260-1g.berkeley.edu (Noam Mendelson) writes:
>In article <1991Apr28.222052.19789 at agate.berkeley.edu> raymond at ursa.berkeley.edu (Raymond Yee) writes:
>>How do I print out output from the 'man' program or store 'man' output
>>in a file without having all the extraneous control characters?
>
>	nroff -man foo.man
>

That gives you the same output as "the 'man' program" would.
I think what the original poster wanted was a way to get
rid of the junk that nroff inserts to do underlining and 
half-line spacing.

You can do that with a simple sed script:

man foo | sed -e 's/_^H//g' -e 's/^[.//g'

where ^H is the backspace character and ^[ is the
ESCape character; you can type these to the shell by
typing "control-V control-H" and "control-V ESC",
respectively (modulo "stty lnext ..."; control-V is
the default.) If you want to put this command in a 
shell script, control-V also works in 'vi'; in emacs,
I think it's control-Q but don't quote me on that.

That should do the trick.


--jeenglis at alcor.usc.edu

  itp



More information about the Comp.unix.questions mailing list