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

Re: man files to text editor



On Wed, Dec 17, 2003 at 10:14:54PM +0100, Jan Minar wrote:
> On Wed, Dec 17, 2003 at 01:07:35PM -0500, Lou Losee wrote:
> > * Gruessle <debian@orces.com> [2003-12-17 12:21]:
> > > Is there a way I can open man files in a text editor.
> > > I like to print one but have not configured my printer jet.
> > > So I will email it to my other pc.
> > 
> > Try man xxx | col -b > text-filename
> 
> This actually should not work, you have to tell man(1) it should send the
> formatted manpage to stdout, instead of messing with the pager.

This is incorrect; it is intended to work as Lou described, and it does
work. man(1) checks whether its standard output is a terminal before
starting a pager. If it isn't, which is the case when you do 'man ... |
...', it simply sends the formatted output to stdout.

> Getting rid of the Latin-1 characters comes handy when mailing the
> output, too.
> 
> $ man --pager cat --ascii foo | col -b > text-filename

--ascii is kind of a hack, and I'd like to get rid of it eventually or
implement it in terms of other things. I tend to say 'LANG=C man
-Tascii' for this.

> Now we want the lines narrower than the default 80 characters (I guess
> this won't work if man(1) is connected to the terminal, so the pipe is
> vital here (that's why we use cat(1) as a pager--to force piping).
> 
> $ env COLUMNS=70 man --pager cat --ascii foo | col -b > text-filename

The '--pager cat' continues to be unnecessary here; $COLUMNS is still
honoured. I prefer using the special-purpose $MANWIDTH for this, though.

Narrowing the page does work even if man's output is a terminal.

Cheers,

-- 
Colin Watson (man-db maintainer)              [cjwatson@flatline.org.uk]



Reply to: