Saving man pages

Discussion in 'Mac Basics and Help' started by neesthan, Dec 3, 2011.

  1. neesthan macrumors newbie

    Joined:
    Dec 3, 2011
    #1
    Hello. I try to save some man pages on my Snow Leopard. I do it the following way:
    Code:
    man cp > man_cp.txt
    
    Then when I try to open it in Terminal like this
    Code:
    less man_cp.txt
    
    it looks fine. But when I try to open it in TextEdit, for instance, the text looks very strange - some characters are doubled like this:
    If I try to print it out on a printer it also looks wrong.
    What's the reason?
     
  2. chown33 macrumors 604

    Joined:
    Aug 9, 2009
    #2
    The default output from man is formatted for a simple terminal or printer using backspaces and overstrikes. You can't see backspaces and overstrikes in TextEdit.app.

    Everywhere you see a doubled character, there's a backspace between them. This represents bold. Where you see _ followed by a letter, that's underlined, and there's a backspace between them, too.

    If your goal is to print man pages on a printer, I suggest getting Bwana, opening the man page in your web browser, and printing it from there.

    If your goal is something else, please explain exactly what it is.
     
  3. neesthan thread starter macrumors newbie

    Joined:
    Dec 3, 2011
    #3
    Thanks, chown33, for your exhaustive explanation why the text looks that way.
    My goal was just to print it out on paper for reference. I have just got a suggestion from another forum - using -t option:
    Code:
    man -t cp > man_cp
    
    It will save man_cp as a PostScript file which then can be viewed and printed through Preview.app, for instance.
     
  4. neesthan thread starter macrumors newbie

    Joined:
    Dec 3, 2011
    #5
  5. wrldwzrd89 macrumors G5

    wrldwzrd89

    Joined:
    Jun 6, 2003
    Location:
    Solon, OH
    #6
    Code:
    man exiv2 | col -b | open -f
    
    ... will do what you want.
    Replace "exiv2" with the name of the program in question. That will open the manual in TextEdit, formatted neatly.

    Tip from here: http://www.tuaw.com/2007/04/19/terminal-tip-output-man-pages-as-plain-text-with-col/
     
  6. neesthan thread starter macrumors newbie

    Joined:
    Dec 3, 2011
    #7
    Well, I think this way is even better because you don't need to save the file. The only thing: if one wants to open a manual in a specific application, for instance, TextWrangler, one need to add -a and the path to that application:
    Code:
    man exiv2 | col -b | open -f -a /Applications/TextWrangler.app
    
    Thanks to everybody!
     

Share This Page