Create HTML versions of UNIX apps' man pages

Jun 23, '03 09:33:00AM

Contributed by: Anonymous

I view the man pages for GMT (Generic Mapping Tools) a lot, both on my local machine and the web. I find the online HTML version easier to read, but sometimes my PowerBook is not connected to the web and I need to consult the man page. Here is a quick script that will make the man pages available as local HTML files for access from the Dock. While I provide an example for GMT, it could be used to make a folder for any man page.

Requires: rman (or similar program) and in this case GMT. Both are available via fink.

  1. Make a folder (herein entitled "GMT_man").

  2. In that folder (cd /path/to/GMT_man) in the Terminal.app, type:
     % /bin/ls /sw/share/man/manl/ > list1
     % /bin/ls /sw/share/man/manl/ | sed 's/\.\l//g' > list2
     % paste list1 list2 > list2
     % awk '{print "rman -f html /sw/share/man/manl/"$1,">", $2}' \
       list2 > htmlit.csh
     % chmod u+rwx htmlit.csh 
  3. Lastly, execute the shell script:
     % ./htmlit.csh 
I then removed all of the lists and script and dragged the folder "GMT_man" to the Dock. Now when I want to view a man page of a GMT command, I just single-click the folder and pick from all of the commands. That then opens the HTML file in my default browser for viewing.

Comments (2)


Mac OS X Hints
http://hints.macworld.com/article.php?story=20030619135944369