man page text output (was Re: FreeBSD 11.0-RELEASE-p7 i386 system drive imaging and migration)
    Polytropon 
    freebsd at edvax.de
       
    Tue Jan 31 02:18:14 UTC 2017
    
    
  
On Mon, 30 Jan 2017 18:00:53 -0700 (MST), Warren Block wrote:
> It used to be possible to generate "ascii" outpu with groff.  Now we 
> have mandoc, which can surely do it, but I don't see how:
> 
>    mandoc -T ascii rc.conf
>    mandoc: rc.conf: ERROR: No such file or directory
> 
> It might just be a missing MANPATH setting, I don't know. I'm also not 
> sure whether "ascii" output included the control characters.
The following command will generate an "ASCII rendering" of
a man page:
	% zcat /usr/share/man/en.ISO8859-1/man5/rc.conf.5.gz | groff -Tascii -mandoc
There also is a more elegant way to turn the long path name
into a nice command substitution, in case the actual manual
page _file_ is not to be specified explicitely:
	% zcat `man -w rc.conf` | groff -Tascii -mandoc
This output can be easily grepped on a "text only" basis as
it doesn't contain any control (replacement) characters
anymore.
A problem can probably occur when there are entries in more
than one section for a given topic, like for example "man 1 open",
"man 2 open", and "man 3 open".
-- 
Polytropon
Magdeburg, Germany
Happy FreeBSD user since 4.0
Andra moi ennepe, Mousa, ...
    
    
More information about the freebsd-questions
mailing list