Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Is there a way to get the source out of the a preformatted man page? I need to parse the man page sources on different platforms and on one pc there are only cat pages, and I don't want to write 2 scripts for both situations.

Greets, Oliver

share|improve this question

You can't "generate" the *roff source from a formatted man page. However, you could simply write your script to work with the formatted version, and then run unformatted man pages through nroff. This way, you write one script instead of two and it works on all your target platforms.

share|improve this answer
Yeah, that sounds like a good solution... then I even don't have to deal with different source formats... thx! – Trollhorn Dec 14 '09 at 9:47
Hm, now I have the problem that the cat page is VERY difficult to parse due to escape sequences... should I strip them first? – Trollhorn Dec 15 '09 at 12:17
Probably, yes. Take a look at the "colcrt" command. Try, for example, "man ls | colcrt - | less". In fact, compare "man ls | less -RU" to "man ls | colcrt - | less -RU" to see exactly what's going on. – larsks Dec 15 '09 at 14:17

You should probably look at man man.

You can find the source file for a given man page with man --path command - so man --path man will give a result of /usr/share/man/en/man1/man.1.gz

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.