groff
[Top][All Lists]
Advanced

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

Re: [Groff] Parsing specific section of man page


From: Ted Harding
Subject: Re: [Groff] Parsing specific section of man page
Date: Sun, 22 Jan 2012 09:58:27 -0000 (GMT)

Follow-up to my previous reply:

On 22-Jan-2012 Ted Harding wrote:
> On 22-Jan-2012 Siteshwar Vashisht wrote:
>> Hi,
>> Is there any option in groff to parse only a specifiec
>> section of man page? For e.g. when I say
>> 
>> groff -X -P -resolution -P100 -man passwd
>> 
>> It parses and shows me the whole page. What if I want to
>> parse only OPTIONS section ? I am looking for something like :-
>> 
>> groff -X -P -resolution -P100 -man -parse-section "OPTIONS" passwd
>> 
>> Regards,
>> Siteshwar
>> -- 
>> "A belief may be larger than a fact."
>> Vannevar Bush
> 
> No, groff always processes the entire document as presented
> in the troff source for the document.
> [...]
> Ted.

Am alternative approach to achieveing the effect you seek
could be to pass the source for .../man1/passwd through
a custom-writer pre-filter (via a command-line-invoked
paramatrised shell script, say).

The structure of a man-page is very straightforward.
There are a few initial set-up lines, then a series of
sections each introduced by a line like

.SH "NAME"
[...]
.SH "SYNOPSIS"
[...]
.SH "DESCRIPTION"
[...]

etc. The rest of the file is of this form, and there are
no final lines which must be used.

So the script would need to recognise lines beginning ".SH".
For the first such occurrence, if the name is not the one
you have specified, then suppress throughput until the
occurrence of the ".SH" section you seek.

If it is the one you seek, then continue throughput.

Once within throughput of the section you seek, continue
until the next occurrence of a ".SH" line and thereafter
suppress throughput until the end of file.

Ted.

-------------------------------------------------
E-Mail: (Ted Harding) <address@hidden>
Date: 22-Jan-2012  Time: 09:58:21
This message was sent by XFMail
-------------------------------------------------


reply via email to

[Prev in Thread] Current Thread [Next in Thread]