{
    "mode": "man",
    "parameter": "lexgrog",
    "section": "1",
    "url": "https://www.chedong.com/phpMan.php/man/lexgrog/1/json",
    "generated": "2026-05-30T05:14:33Z",
    "synopsis": "lexgrog [-m|-c] [-dfw?V] [-E encoding] file ...",
    "sections": {
        "NAME": {
            "content": "lexgrog - parse header information in man pages\n",
            "subsections": []
        },
        "SYNOPSIS": {
            "content": "lexgrog [-m|-c] [-dfw?V] [-E encoding] file ...\n",
            "subsections": []
        },
        "DESCRIPTION": {
            "content": "lexgrog  is  an implementation of the traditional “groff guess” utility in lex.  It reads the\nlist of files on its command line as either man  page  source  files  or  preformatted  “cat”\npages,  and  displays  their  name and description as used by apropos and whatis, the list of\npreprocessing filters required by the man page before it is passed  to  nroff  or  troff,  or\nboth.\n\nIf  its  input  is badly formatted, lexgrog will print “parse failed”; this may be useful for\nexternal programs that need to check man pages for correctness.  If one  of  lexgrog's  input\nfiles  is  “-”,  it  will read from standard input; if any input file is compressed, a decom‐\npressed version will be read automatically.\n",
            "subsections": []
        },
        "OPTIONS": {
            "content": "",
            "subsections": [
                {
                    "name": "-d --debug",
                    "content": "Print debugging information.\n",
                    "flag": "-d",
                    "long": "--debug"
                },
                {
                    "name": "-m --man",
                    "content": "Parse input as man page source files.  This is the default if neither --man nor  --cat\nis given.\n",
                    "flag": "-m",
                    "long": "--man"
                },
                {
                    "name": "-c --cat",
                    "content": "Parse input as preformatted man pages (“cat pages”).  --man and --cat may not be given\nsimultaneously.\n",
                    "flag": "-c",
                    "long": "--cat"
                },
                {
                    "name": "-w --whatis",
                    "content": "Display the name and description from the man page's header, as used  by  apropos  and\nwhatis.  This is the default if neither --whatis nor --filters is given.\n",
                    "flag": "-w",
                    "long": "--whatis"
                },
                {
                    "name": "-f --filters",
                    "content": "Display  the  list of filters needed to preprocess the man page before formatting with\nnroff or troff.\n",
                    "flag": "-f",
                    "long": "--filters"
                },
                {
                    "name": "-E --encoding",
                    "content": "Override the guessed character set for the page to encoding.\n\n-?, --help\nPrint a help message and exit.\n",
                    "flag": "-E",
                    "long": "--encoding"
                },
                {
                    "name": "--usage",
                    "content": "Print a short usage message and exit.\n",
                    "long": "--usage"
                },
                {
                    "name": "-V --version",
                    "content": "Display version information.\n",
                    "flag": "-V",
                    "long": "--version"
                }
            ]
        },
        "EXIT STATUS": {
            "content": "0      Successful program execution.\n\n1      Usage error.\n\n2      lexgrog failed to parse one or more of its input files.\n",
            "subsections": []
        },
        "EXAMPLES": {
            "content": "$ lexgrog man.1\nman.1: \"man - an interface to the system reference manuals\"\n$ lexgrog -fw man.1\nman.1 (t): \"man - an interface to the system reference manuals\"\n$ lexgrog -c whatis.cat1\nwhatis.cat1: \"whatis - display manual page descriptions\"\n$ lexgrog broken.1\nbroken.1: parse failed\n",
            "subsections": []
        },
        "WHATIS PARSING": {
            "content": "mandb (which uses the same code as lexgrog) parses the NAME section at the top of each manual\npage looking for names and descriptions of the features documented in each.  While the parser\nis quite tolerant, as it has to cope with a number of different forms that have  historically\nbeen used, it may sometimes fail to extract the required information.\n\nWhen using the traditional man macro set, a correct NAME section looks something like this:\n\n.SH NAME\nfoo \\- program to do something\n\nSome  manual  pagers require the ‘\\-’ to be exactly as shown; mandb is more tolerant, but for\ncompatibility with other systems it is nevertheless a good idea to retain the backslash.\n\nOn the left-hand side, there may be several names, separated  by  commas.   Names  containing\nwhitespace  will  be  ignored to avoid pathological behaviour on certain ill-formed NAME sec‐\ntions.  The text on the right-hand side is free-form, and may be spread over multiple  lines.\nIf several features with different descriptions are being documented in the same manual page,\nthe following form is therefore used:\n\n.SH NAME\nfoo, bar \\- programs to do something\n.br\nbaz \\- program to do nothing\n\n(A macro which starts a new paragraph, like .PP, may be used instead of the break macro .br.)\n\nWhen using the BSD-derived mdoc macro set, a correct NAME section looks something like this:\n\n.Sh NAME\n.Nm foo\n.Nd program to do something\n\nThere are several common reasons why whatis parsing fails.  Sometimes authors of manual pages\nreplace ‘.SH NAME’ with ‘.SH MYPROGRAM’, and then mandb cannot find the section from which to\nextract the information it needs.  Sometimes authors include a NAME section, but place  free-\nform  text there rather than ‘name \\- description’.  However, any syntax resembling the above\nshould be accepted.\n",
            "subsections": []
        },
        "SEE ALSO": {
            "content": "apropos(1), man(1), whatis(1), mandb(8)\n",
            "subsections": []
        },
        "NOTES": {
            "content": "lexgrog attempts to parse files containing .so requests, but will only be able to do so  cor‐\nrectly if the files are properly installed in a manual page hierarchy.\n",
            "subsections": []
        },
        "AUTHOR": {
            "content": "The code used by lexgrog to scan man pages was written by:\n\nWilf. (G.Wilford@ee.surrey.ac.uk).\nFabrizio Polacco (fpolacco@debian.org).\nColin Watson (cjwatson@debian.org).\n\nColin Watson wrote the current incarnation of the command-line front-end, as well as this man\npage.\n",
            "subsections": []
        },
        "BUGS": {
            "content": "https://gitlab.com/cjwatson/man-db/-/issues\nhttps://savannah.nongnu.org/bugs/?group=man-db\n\n\n\n2.10.2                                       2022-03-17                                   LEXGROG(1)",
            "subsections": []
        }
    },
    "summary": "lexgrog - parse header information in man pages",
    "flags": [
        {
            "flag": "-d",
            "long": "--debug",
            "arg": null,
            "description": "Print debugging information."
        },
        {
            "flag": "-m",
            "long": "--man",
            "arg": null,
            "description": "Parse input as man page source files. This is the default if neither --man nor --cat is given."
        },
        {
            "flag": "-c",
            "long": "--cat",
            "arg": null,
            "description": "Parse input as preformatted man pages (“cat pages”). --man and --cat may not be given simultaneously."
        },
        {
            "flag": "-w",
            "long": "--whatis",
            "arg": null,
            "description": "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."
        },
        {
            "flag": "-f",
            "long": "--filters",
            "arg": null,
            "description": "Display the list of filters needed to preprocess the man page before formatting with nroff or troff."
        },
        {
            "flag": "-E",
            "long": "--encoding",
            "arg": null,
            "description": "Override the guessed character set for the page to encoding. -?, --help Print a help message and exit."
        },
        {
            "flag": "",
            "long": "--usage",
            "arg": null,
            "description": "Print a short usage message and exit."
        },
        {
            "flag": "-V",
            "long": "--version",
            "arg": null,
            "description": "Display version information."
        }
    ],
    "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"
    ],
    "see_also": [
        {
            "name": "apropos",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/apropos/1/json"
        },
        {
            "name": "man",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/man/1/json"
        },
        {
            "name": "whatis",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/whatis/1/json"
        },
        {
            "name": "mandb",
            "section": "8",
            "url": "https://www.chedong.com/phpMan.php/man/mandb/8/json"
        }
    ]
}