1

In order to simplify my question, I mainly consider man pages of commands. eg «man grep». Man pages are, more or less, structured. Most sections and their presentation are standard, and an explanation can be found on https://www.tldp.org/HOWTO/Man-Page/q3.html (And the source of man page, in groff, is not really hard to understand, even without knowing groff)

My question is: is there already a database with the (more standard) man pages. Or at least a program, taking as input a man page (as a groff file, probably) and output such a database. Here, I mean database in a very vague sens. Sqlite or mysql would be perfect. But a zip of csv would also be great. Let me give you an example using man grep.

The database would have an option table, with an entry for each option. This entry would contains: - the actual option name(s) - The abbreviation(s), - The description of what this option does - The enclosing section. . In CSV, an entry would be --extended-regexp, -E, Interpret PATTERN as an extended regular expression (ERE\, see below). (-E is specified by POSIX .), Matcher Selection

It would have an "exit" table, with: 0, selected lines are found 1, otherwise 2 an error occurred\, unless the -q or --quiet or --silent option is used and a selected line is found.

And so on for each standard kind of sections of the man page. And a table with every text which was not successfully put in some other table.

I hope that some part of it would be simple to parse, for example creating the option table. But some other part would be quite hard, for example the exit status. Which is why I really want to know whether something like that is already done, in order not to do it myself.

Arthur Rainbow
  • 216
  • 1
  • 8

1 Answers1

0

You can download man pages with git clone http://git.kernel.org/pub/scm/docs/man-pages/man-pages

youyoup
  • 559
  • 1
  • 6
  • 9
  • Not a bad suggestion, but it doesn't satisfy the original poster's stipulation that it be in a structured format. Also, [as stated on the project page](https://www.kernel.org/doc/man-pages/), `man-pages` only includes "a small number of Section 1 pages that document programs supplied by the GNU C library." So it's missing most of the "interesting" user commands. – TheDudeAbides Nov 01 '22 at 21:18