?
Solved

Saving UNIX manual man pages into plain text files with proper formatting

Posted on 2005-03-21
6
Medium Priority
?
338 Views
Last Modified: 2010-03-17
I would like to save the formatted plain text output of UNIX (HP-UX) manual pages into plain text files for later searching.
I have found a partial solution in the  question listed below which is something like:

man cut | nroff -Tlp | sed 's/.^H//g' | tee cut.ascii.man | more
(The more is there for troubleshooting)
=====================================

The problem is that this wraps on column 66!!

=====================================
refferenced question:
=====================================
Solution Title: how to output the man pages to a file?
asked by academic on 08/31/2000 12:29PM PDT
=====================================
(By the way how do I get the actual question id for the above so that I don't have to reffer to it by title and date?)
The original solution called for groff and -Tascii.
However,  problem is that:
a) I am working in a corporate HP-UX 11.11 environment with little control of SA stuff.\
b) I do not have groff (GNU roff -right?) so I used nroff and substituted -Tlp.
c) All is well except that the output is wrapped for me on COLUMN 66 !

It looks like nroff is using /usr/lib/term/termlp.  Perhaps it thinks the output device is only 65 chars?
I don't know its format and can't control it if I did.

My main motivation is to be able ot search frequently used man pages with vi.
I don't have less.  I could probably have it but would still rather have a file with vi.

My main reason for this is that I am using putty to connect to HP-UX as an xterm and have set colors for approximately black on white.
man insists on lighting up inverse video which makes it look unreadable as it happens in so many places.

A workaround would be to ask the xterm, man or putty not to do the inverse video.
However, I fear this also involves termcap, another system resource over which I have no control.

I would like to award 250 points if the moderator  allows the post.  If it is not allowed please answer my questions in some detail.

Thanks.




0
Comment
Question by:spyro0
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
6 Comments
 
LVL 96

Expert Comment

by:Lee W, MVP
ID: 13595654
Maybe I'm missing something - it's quite possible as I'm not great in Unix and I've never even touched HP UX.  But why not just redirect output to a file?

man command > command.man
0
 

Author Comment

by:spyro0
ID: 13595985

Try it.  You'll see that all of the terminal control chars are embedded in the file.  This is not an HP-UX issue but common to all UNIXs with these commands, i.e. all as they are part of the original distributions from the Bell Labs days.  This embeded chars are the problem in this case..

I have something to add in the way of a workaround.  I just found a link for some wonderful link for nicely formatted HTML UNIX man pages on hp's site.  The following link reffences the HP-UX 11.0 set.  This will do for me for now, but I would still like an answer to the nroff battle...

Thaniks for the comment in any case...

http://www.docs.hp.com/en/B2355-90680/index.html 

0
 
LVL 15

Accepted Solution

by:
veedar earned 1000 total points
ID: 13597416
You need col -b for example...

man  date | col -b > date.man
0
Portable, direct connect server access

The ATEN CV211 connects a laptop directly to any server allowing you instant access to perform data maintenance and local operations, for quick troubleshooting, updating, service and repair.

 

Author Comment

by:spyro0
ID: 13604093
veedar,

Thanks so much this was the pefect and simplest solution.  It does exaclty want I wanted -plain text properly formatted manual pages which I can then use vi to search in.

Can you tell me how I can change the pagination i.e. the number of lines per page.
I did a man man and did not see an option.
What is the mechanisim which determines the number of lines per page, the number of columns per page etc.
I suspect that it is nroff and /usr/share/lib/term/* issue but would love more details.

I would like to print the manual pages using a smaller font and so need to control pagination.
I can explore alternatives such as converting the pages to postscript first and then sending them to the  printer however, I would like a better understanding of the issue.

On a related issue, the issue which started this question was the liberal use of inverse video in my putty/xterm.
Do you know how I can turn inverse video off on my putty/xterm.  I am using blackish on off white for the display and the inverse video is very difficult to read.  I'll be happy to open another question if you like.

Also my original posting asked how to get the question id of an answered question -any idea?
0
 
LVL 15

Expert Comment

by:veedar
ID: 13607205
spyro0,
I haven't worked on HP-UX in a while but I do recall the inverse video
annoyance.  What were they thinking?

Anyway to change the pagination I would change the deafults used by man,
See the $PAGER environment variable as seen from "man man". You can change
to a different pager or change the options to the default pager, check out man
pager.

I  think you are on the right track with postscript I used to use postscript
commands to have 2 or 4 pages shrunk and fitted to print on one page. I do
not recall the details, I think maybe the postprint command was involved.

Sorry I can't think of anything off hand to help with your putty/xterm issue.
Maybe repacing xterm with rxvt or another might do it.

Let me suggest you check out the HP-UX resources listed at http://www.stokely.com
/unix.sysadm.resources/faqs.a-m.htm

stokely.com has been around for years and is a great and trusted resource for UNIX admins.

Good Luck,
V




0
 
LVL 15

Expert Comment

by:veedar
ID: 13607231
Oh and ask about your question id's
on the community support page
http://www.experts-exchange.com/allTopics.jsp?t=180
0

Featured Post

WordPress Tutorial 2: Terminology

An important part of learning any new piece of software is understanding the terminology it uses. Thankfully WordPress uses fairly simple names for everything that make it easy to start using the software.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I have seen several blogs and forum entries elsewhere state that because NTFS volumes do not support linux ownership or permissions, they cannot be used for anonymous ftp upload through the vsftpd program.   IT can be done and here's how to get i…
Note: for this to work properly you need to use a Cross-Over network cable. 1. Connect both servers S1 and S2 on the second network slots respectively. Note that you can use the 1st slots but usually these would be occupied by the Service Provide…
If you're a developer or IT admin, you’re probably tasked with managing multiple websites, servers, applications, and levels of security on a daily basis. While this can be extremely time consuming, it can also be frustrating when systems aren't wor…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
Suggested Courses
Course of the Month8 days, 10 hours left to enroll

765 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question