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.
If its input is badly formatted, lexgrog will print “parse failed”;
this may be useful for external programs that need to check man pages
for correctness. If one of lexgrog's input files is “-”, it will
read from standard input; if any input file is compressed, a
decompressed version will be read automatically.
Print debugging information.
Parse input as man page source files. This is the default if
neither --man nor --cat is given.
Parse input as preformatted man pages (“cat pages”). --man
and --cat may not be given simultaneously.
Display the name and description from the man page's header,
as used by apropos and whatis. This is the default if neither
--whatis nor --filters is given.
Display the list of filters needed to preprocess the man page
before formatting with nroff or troff.
-E encoding, --encoding encoding
Override the guessed character set for the page to encoding.
Print a help message and exit.
Print a short usage message and exit.
Display version information.
mandb (which uses the same code as lexgrog) parses the NAME section
at the top of each manual page looking for names and descriptions of
the features documented in each. While the parser is quite tolerant,
as it has to cope with a number of different forms that have
historically been used, it may sometimes fail to extract the required
When using the traditional man macro set, a correct NAME section
looks something like this:
foo \- program to do something
Some manual pagers require the ‘\-’ to be exactly as shown; mandb is
more tolerant, but for compatibility with other systems it is
nevertheless 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
pathological behaviour on certain ill-formed NAME sections. The text
on the right-hand side is free-form, and may be spread over multiple
lines. If several features with different descriptions are being
documented in the same manual page, the following form is therefore
foo, bar \- programs to do something
baz \- 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:
.Nd program to do something
There are several common reasons why whatis parsing fails. Sometimes
authors of manual pages replace ‘.SH NAME’ with ‘.SH MYPROGRAM’, and
then mandb cannot find the section from which to extract the
information it needs. Sometimes authors include a NAME section, but
place free-form text there rather than ‘name \- description’.
However, any syntax resembling the above should be accepted.
The code used by lexgrog to scan man pages was written by:
Fabrizio Polacco (firstname.lastname@example.org).
Colin Watson (email@example.com).
Colin Watson wrote the current incarnation of the command-line front-
end, as well as this man page.
This page is part of the man-db (manual pager suite) project.
Information about the project can be found at
⟨http://www.nongnu.org/man-db/⟩. If you have a bug report for this
manual page, send it to firstname.lastname@example.org. This page was
obtained from the project's upstream Git repository
⟨http://git.savannah.gnu.org/r/man-db.git⟩ on 2017-03-13. If you dis‐
cover any rendering problems in this HTML version of the page, or you
believe there is a better or more up-to-date source for the page, or
you have corrections or improvements to the information in this
COLOPHON (which is not part of the original manual page), send a mail
126.96.36.199 2016-12-12 LEXGROG(1)