LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 10-31-2006, 04:48 PM   #1
stabu
Member
 
Registered: Mar 2004
Location: dublin IRL
Distribution: Slackv12.1, Slamd64v12.1,Xubuntu v8.10_64, FC8_64
Posts: 438
Blog Entries: 5

Rep: Reputation: 32
bunzip2 mplayer's manpage, get overstrikes


Hi,

I use the mplayer's manpage very often and got fed up with how slow man command was, especially when you want to search for an command line option fast.

SO I got the manpage (a bz2 file), bunzip2'ed it (got mplayer.1), and the "file" commandtold me it was text but with overstrikes. However the cat and less commands didn't seem to care, but vim certainly does. In vim, and on my box, this file appears infested with "^H"'s, which I expect are the overstrikes that the file command reports.

Anyone know what's going on?
 
Old 11-01-2006, 05:42 AM   #2
stabu
Member
 
Registered: Mar 2004
Location: dublin IRL
Distribution: Slackv12.1, Slamd64v12.1,Xubuntu v8.10_64, FC8_64
Posts: 438

Original Poster
Blog Entries: 5

Rep: Reputation: 32
only 16 reads in 12 hours? And no replies?

OK, I hear you: "go to vim.org!"

And you know what? I will. That's a community and a half!

Sniff.
 
Old 11-01-2006, 08:36 AM   #3
matthewg42
Senior Member
 
Registered: Oct 2003
Location: UK
Distribution: Kubuntu 12.10 (using awesome wm though)
Posts: 3,530

Rep: Reputation: 65
Don't cry. Come sit by the fire and I'll tell you a little story.

Manual pages are stored in a markup language which is processed by the nroff program when you run man. They are often also compressed to preserve disk space.

The output of nroff is intended for display for terminals, which have strange ways of doing things like showing bold text. The heritage of this is quite interesting, going back to teletype machines where the output was literally printed onto paper. This is where these ^H characters come from. The ^H was the way the teletype was told to go back once space. Thus sending a^Ha would print an a character, go back one space and print another a character - this would make the a appear darker than other text - a simple way to get bold type without needing extra hardware! In a similar way, you could get an underlined hello by sending h^H_e^H_l^H_l^H_o^H_ to the teletype.

Modern virtual terminal programs are a long way from the old teletype printers, but they still support this funny way of getting formatted text, and the manual system generally works pretty well... if it ain't broken don't fix it, right?

There have been several attempts to get rid of the manual system in unix-like OSes, I suspect in part because of it's antiquated mechanism. But it's so damn useful, and many people (me included) like the simplicity of simple named pages which aren't linked together in a hypertext glob.

Now your mplayer.1 file looks a little odd... it seems to be the output of nroff, as formatted for a terminal, which is unexpected because usually .1 files are the nroff input - the un-processed markup language.

It may be that you got the mplayer.1 file from catman directory. Catman is an attempt to speed up the manual system by doing the markup process once, and cacheing the results. the catman files are already in the format for terminal display, which sounds like your mplayer.1 file.

OK anyhow, the question I think you want to know the answer for is "how can I convert my mplayer.1 file to plain text without all this ^H stuff in it?", right?

The answer is one of those annoying things which I know I have successfully solved in the past after some difficulty finding a simple and elegant solution with man and/or nroff/groff, but now it eludes me.

If you use the GNU implementations of man and friends, and have lynx installed you can do this:
Code:
BROWSER='lynx -dump' man -H mplayer > mplayer.txt
...which will ask man to output in HTML format, and use lynx in text dump mode to display the page, we then use the shell to re-direct the output to mplayer.txt, which is a text version of the HTML manual page.



...and they all lived happily ever after.
 
Old 12-01-2006, 02:31 AM   #4
stabu
Member
 
Registered: Mar 2004
Location: dublin IRL
Distribution: Slackv12.1, Slamd64v12.1,Xubuntu v8.10_64, FC8_64
Posts: 438

Original Poster
Blog Entries: 5

Rep: Reputation: 32
Hi Matthew,

Gosh thanks so much! That's a really good explanation, I hadn't checked in so all I can offer now is belated thanks. I guess I can stop crying now - it will save me a fortune in plumbers (believe me they charge a fortune) as I had the house flooded :-)

/ stabu
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Understanding find manpage sporty Linux - Newbie 2 07-27-2006 01:39 PM
cannot bunzip2 toasted Linux From Scratch 3 06-17-2006 06:27 PM
Announcing RTFM the ManPage Browser and Viewer gnashley Slackware 2 05-19-2006 10:35 AM
is bunzip2 the best for compressing? dr_zayus69 Linux - Software 3 01-25-2005 12:15 AM
bunzip2 for RH7.1 glock19 Linux - General 1 08-10-2001 01:31 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 04:51 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration