Path: utzoo!utgpu!news-server.csri.toronto.edu!bonnie.concordia.ca!uunet!elroy.jpl.nasa.gov!usc!chaph.usc.edu!alcor.usc.edu!jeenglis From: jeenglis@alcor.usc.edu (Joe English) Newsgroups: comp.unix.questions Subject: Re: printing out manual pages Keywords: man Message-ID: <16958@chaph.usc.edu> Date: 29 Apr 91 08:31:55 GMT References: <1991Apr28.222052.19789@agate.berkeley.edu> <1991Apr28.232157.24943@agate.berkeley.edu> Sender: news@chaph.usc.edu Organization: Free Roger Carasso! Lines: 31 Nntp-Posting-Host: alcor.usc.edu c60b-1eq@e260-1g.berkeley.edu (Noam Mendelson) writes: >In article <1991Apr28.222052.19789@agate.berkeley.edu> raymond@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@alcor.usc.edu itp