Find the answer to your Linux question:
Results 1 to 9 of 9
How can I create a text file from a man page? I tried: man -P cat appname > appname.txt This was pretty close, but it still had a lot of ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Mar 2005
    Posts
    38

    Create text file from man page


    How can I create a text file from a man page?

    I tried: man -P cat appname > appname.txt

    This was pretty close, but it still had a lot of formatting codes and duplicate letters (for the bold).

    Is there a simple way to simply dump the text with minimal formatting? I assume so because there are many web pages that display the man page for apps.

    Thanks.

    Pete

  2. #2
    Linux Newbie
    Join Date
    Feb 2005
    Location
    Texas
    Posts
    168
    Why don't you just copy and paste the text you want?

    I would open the man page, highlight the desired text, select copy from the edit menu, and then paste it into an open text editor of your choice.

    May not be the most elegant solution but it would work.

    Jeff
    Registered Linux User #391940

  3. #3
    Linux User nalg0rath's Avatar
    Join Date
    Sep 2004
    Location
    Stockholm
    Posts
    303
    Try this:
    Code:
    man [manual] | col -b > file.txt

  4. $spacer_open
    $spacer_close
  5. #4
    Just Joined!
    Join Date
    Mar 2005
    Posts
    38
    Thanks, that was just what I needed.

    As for the Copy/Paste suggestion, that's a real headache when you're working from a terminal and the man page is really long.

    Pete

  6. #5
    Linux Guru
    Join Date
    May 2004
    Location
    forums.gentoo.org
    Posts
    1,817
    I asked a similar question a while back and got a slightly different response: http://www.linuxforums.org/forum/pos...61.html#168961
    That gives a postscript output that can be piped to a printer for a nice result.
    /IMHO
    //got nothin'
    ///this use to look better

  7. #6
    Linux Guru
    Join Date
    Oct 2001
    Location
    Täby, Sweden
    Posts
    7,578
    Alternatively, you can pipe it to a PS viewer program for online viewing. That's also quite a nice alternative over a terminal pager for viewing a man page, since it's neatly formatted and all.

    For example, to use Gnome's PS viewer, ggv:
    Code:
    man -t ls | ggv -

  8. #7
    Just Joined!
    Join Date
    Mar 2005
    Posts
    38
    Interesting. Actually, I just wanted plain text so that I could load it into a web browser on my Windoze box, so I could have easy searching and scrolling while being able to use the information in my terminal windows.

    My Linux box is my file server/router, and a few other things, but not a desktop box. It's located in a closet in another room, so I only access it from telnet.

    My main issue was editing scripts while being able to easily maneuver long a couple very long man pages for a couple apps that I use quite a bit.

    Pete

  9. #8
    Linux Guru
    Join Date
    Oct 2001
    Location
    Täby, Sweden
    Posts
    7,578
    In that case, you may be more interested in man2html. Unfortunately, man2html doesn't search for man pages itself, but it can be automated with this shell command:
    Code:
    man -W thecommandyouwant | grep -v cache | head -n1 | xargs zcat | man2html >/path/to/outputfile.html

  10. #9
    Linux Engineer
    Join Date
    Nov 2004
    Location
    home
    Posts
    796
    You can use groff to add html formatting to the man page.

    bzcat /usr/share/man/man1/nano.1.bz2 | groff -T html -man > nano.1.html

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •