LEXGROG(1)
๐ LEXGROG(1) ยท Manual pager utils ๐
โจ NAME โจ
okay so lexgrog is basically the traditional "groff guess" utility rewritten in lex ๐
it's giving parse-the-header-info-in-man-pages energy ๐ฆ
๐ธ SYNOPSIS ๐ธ
lexgrog [-m|-c] [-dfw?V] [-E encoding] file ...
๐ DESCRIPTION ๐
okay bestie, so lexgrog is an implementation of the classic groff guess utility, but written in lex โจ it reads whatever files you hand it on the command line, and it treats each one as either a man page source file or a preformatted "cat" page ๐ then it spits out their name and description (the stuff apropos and whatis use), the list of preprocessing filters the man page needs before it goes to nroff or troff, or both. literally so useful ๐ญ
if the input is badly formatted, lexgrog will print "parse failed" ๐ this is lowkey great for external programs that want to check whether man pages are correct ๐ซถ if one of your input files is -, it reads from standard input instead ๐ง and if any input file is compressed, no worries, it gets decompressed automatically and read for you โจ
๐ฅ OPTIONS ๐ฅ
-d,--debugโ prints debugging info, for when you need to see the tea โ-m,--manโ parses input as man page source files ๐ this is the default if you don't give--manor--cat-c,--catโ parses input as preformatted man pages ("cat pages") ๐ you can't give--manand--cattogether, bestie, that's a no-go ๐ โโ๏ธ-w,--whatisโ shows the name and description from the man page header, the stuffaproposandwhatisuse ๐ this is the default if you don't give--whatisor--filters-f,--filtersโ shows the list of filters needed to preprocess the man page before you format it with nroff or troff ๐ฆ-E encoding,--encoding encodingโ overrides the guessed character set for the page and uses encoding instead ๐-?,--helpโ prints a help message and exits ๐--usageโ prints a short usage message and exits ๐-V,--versionโ shows version info ๐ง
๐ช EXIT STATUS ๐ช
0โ everything went slay, program ran successfully โจ1โ usage error, you fumbled the command ๐2โlexgrogcouldn't parse one or more of the input files ๐
๐ EXAMPLES ๐
$ lexgrog man.1
man.1: "man - an interface to the system reference manuals"
$ lexgrog -fw man.1
man.1 (t): "man - an interface to the system reference manuals"
$ lexgrog -c whatis.cat1
whatis.cat1: "whatis - display manual page descriptions"
$ lexgrog broken.1
broken.1: parse failed
๐ง WHATIS PARSING ๐ง
okay so mandb (which uses the exact same code as lexgrog) parses the NAME section at the top of each manual page ๐ it's looking for the names and descriptions of the features documented in there. the parser is super tolerant, because it has to cope with a bunch of different forms that people have used over the years ๐ซถ but it can still sometimes fail to pull out the info it needs ๐ญ
when you're using the traditional man macro set, a correct NAME section looks something like this:
.SH NAME
foo \- program to do something
some manual pagers need the \- to be exactly as shown ๐ mandb is more chill about it, but for compatibility with other systems, it's still a good idea to keep the backslash ๐
on the left-hand side, you can have several names separated by commas โจ names with whitespace in them get ignored, to avoid pathological behaviour on certain ill-formed NAME sections ๐ the text on the right-hand side is free-form and can be spread over multiple lines ๐ธ if several features with different descriptions are documented in the same manual page, you'd use this form:
.SH NAME
foo, bar \- programs to do something
.br
baz \- program to do nothing
(a macro that starts a new paragraph, like .PP, can be used instead of the break macro .br ๐ง)
when you're using the BSD-derived mdoc macro set, a correct NAME section looks something like this:
.Sh NAME
.Nm foo
.Nd program to do something
there are a few common reasons why whatis parsing fails ๐ญ sometimes authors swap .SH NAME for .SH MYPROGRAM, so mandb can't find the section it needs to grab info from ๐ other times authors include a NAME section but put free-form text in there instead of name \- description ๐ anyway, any syntax that resembles the above should be accepted ๐
๐ SEE ALSO ๐
apropos(1), man(1), whatis(1), mandb(8) ๐ฆ
๐ NOTES ๐
lexgrogtries to parse files containing.sorequests, but it can only do that correctly if the files are properly installed in a manual page hierarchy ๐
๐ AUTHOR ๐
the code lexgrog uses to scan man pages was written by:
- Wilf. (G.Wilford@ee.surrey.ac.uk) ๐
- Fabrizio Polacco (fpolacco@debian.org) ๐
- Colin Watson (cjwatson@debian.org) ๐
Colin Watson wrote the current command-line front-end, as well as this man page ๐ซถ
๐ BUGS ๐
report them here, bestie ๐
and that's the tea โ version 2.13.1, dated 2025-05-02, LEXGROG(1) ๐ you're literally ready now bestie โจ๐ซถ
๐ฆ where this page comes from
- alpine 3.24: man-db-doc 2.13.1-r1 ยท GPL-2.0-or-later
- arch rolling: man-db 2.13.1-2 ยท GPL-2.0-or-later AND GPL-3.0-or-later
- debian trixie: man-db 2.13.1-1 ยท GPL-2.0-or-later
- fedora 43: man-db 2.13.1-2.fc43 ยท GPL-2.0-or-later AND GPL-3.0-or-later
- fedora 44: man-db 2.13.1-3.fc44 ยท GPL-2.0-or-later AND GPL-3.0-or-later
- nixos 26.05: man-db 2.13.1
- nixpkgs unstable: man-db 2.13.1
- ubuntu questing: man-db 2.13.1-1 ยท GPL-2.0-or-later
- ubuntu resolute: man-db 2.13.1-1build1 ยท GPL-2.0-or-later
- ubuntu stonking: man-db 2.13.1-1build1 ยท GPL-2.0-or-later
- Copyright (c) 2001 Colin Watson <cjwatson@debian.org>
- ๐ girlified by anthropic/claude-haiku-5.5 on : a language model's rewrite of the original, under its terms