Linux "lexgrog" Command Line Options and Examples
parse header information in man pages

lexgrog is an implementation of the traditional “groff guess” utility in lex. It reads the list of files on its command line as either man page source files or preformatted “cat” pages, and displays their name and description as used by apropos and whatis, the list of preprocessing filters required by the man page before it is passed to nroff or troff, or both.


Usage:

lexgrog [-m|-c] [-dfw?V] [-E encoding] file ...






Command Line Options:

-d
Print debugging information.
lexgrog -d ...
-m
Parse input as man page source files. This is the default if neither --man nor --cat is given.
lexgrog -m ...
-c
Parse input as preformatted man pages (“cat pages”). --man and --cat may not be given simultaneously.
lexgrog -c ...
-w
Display the name and description from the man page's header, as used by apropos and whatis. This is the default if neither
lexgrog -w ...
--whatis
nor --filters is given.
lexgrog --whatis ...
-f
Display the list of filters needed to preprocess the man page before formatting with nroff or troff.
lexgrog -f ...
-E
Override the guessed character set for the page to encoding.
lexgrog -E ...
-?
Print a help message and exit.
lexgrog -? ...
--usage
Print a short usage message and exit.
lexgrog --usage ...
-V
Display version information.EXIT STATUS0 Successful program execution.1 Usage error.2 lexgrog failed to parse one or more of its input files.EXAMPLES$ lexgrog man.1man.1: "man - an interface to the on-line reference manuals"$ lexgrog -fw man.1man.1 (t): "man - an interface to the on-line reference manuals"$ lexgrog -c whatis.cat1whatis.cat1: "whatis - display manual page descriptions"$ lexgrog broken.1broken.1: parse failedWHATIS PARSINGmandb (which uses the same code as lexgrog) parses the NAME section at the top of each manual page looking for names and descriptionsof the features documented in each. While the parser is quite tolerant, as it has to cope with a number of different forms that havehistorically been used, it may sometimes fail to extract the required information.When using the traditional man macro set, a correct NAME section looks something like this:.SH NAMEfoo \- program to do somethingSome manual pagers require the ‘\-’ to be exactly as shown; mandb is more tolerant, but for compatibility with other systems it isnevertheless a good idea to retain the backslash.On the left-hand side, there may be several names, separated by commas. Names containing whitespace will be ignored to avoid patho‐logical behaviour on certain ill-formed NAME sections. The text on the right-hand side is free-form, and may be spread over multiplelines. If several features with different descriptions are being documented in the same manual page, the following form is thereforeused:.SH NAMEfoo, bar \- programs to do something.brbaz \- program to do nothing(A macro which starts a new paragraph, like .PP, may be used instead of the break macro .br.)When using the BSD-derived mdoc macro set, a correct NAME section looks something like this:.Sh NAME.Nm foo.Nd program to do somethingThere are several common reasons why whatis parsing fails. Sometimes authors of manual pages replace ‘.SH NAME’ with ‘.SH MYPRO‐GRAM’, and then mandb cannot find the section from which to extract the information it needs. Sometimes authors include a NAME sec‐tion, but place free-form text there rather than ‘name \- description’. However, any syntax resembling the above should be accepted.
lexgrog -V ...