I was invited to re-post this question with less opinion, so if it seems familiar, that's why.

How can I convert info pages into man pages? I used to have a shell one liner that flattened an entire info document into a single flat page, suitable for navigating with less, but I seem to have lost it. Please share if you know how to do this. :)

Thanks!

link|improve this question

22% accept rate
Hah, I assume that you were requested to remove anti-info vitriol? If so, I share your feeling... – user5336 Mar 29 '10 at 14:50
feedback

3 Answers

up vote 2 down vote accepted

This will output an info as a flat text file:

info --subnodes --output=info_file.txt info_file

For example:

info --subnodes --output=info.txt info
less info.txt
link|improve this answer
feedback

I didn't want to get out of the habit of typing 'man' so I ended up writing a wrapper using Dennis Williamson's answer.

Contents ~/bin/man:

#!/bin/bash

case $1 in
info-*)
  page=$(echo $1 | sed -e s/info-//g)
  tmpfile="/tmp/info2man-$page.txt"
  info --subnodes --output=$tmpfile $page \
  && less $tmpfile \
  && rm -f $tmpfile
  ;;
*)
  man $@
  ;;
esac

Use case

man sed

# learn the sed man page isn't adequate

man info-sed
link|improve this answer
feedback

The script above does not quite work. For normal man pages, it gets into infinite recursion; not pleasant on the command line. When it invokes the "man" command it has to make sure it's not invoking itself -- this is an issue if it's in a directory that's in your PATH.

Since my ~/bin directory is in my PATH, I changed the end of the "case" list thus:

*)
  /usr/bin/man $@
  ;;
esac

I've never seen the real 'man' be anywhere but /usr/bin/man, so this should work.

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

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