Re: Fw: [newbie] making a file from a man doc
Brendan, Thanks again! So far I've only converted one page, and I did it with: man [progname] | col -b progname.man.txt And then fixed things up as needed. Expect to do more, when I do I'll look for more alternatives. PS: I added your suggestions to a WikiLearn page: http://twiki.org/cgi-bin/view/Wikilearn/TextMarkupInLinux and added your (first) name as a contributor. If you have any comments or suggestions let me know. I'd be happy to add your last name if you tell me what it is. ;-) regards, Randy Kramer Brendan wrote: Hope all of this helps... Tell me how it comes out... Want to buy your Pack or Services from MandrakeSoft? Go to http://www.mandrakestore.com
Re: Fw: [newbie] making a file from a man doc
Brendan, Thanks! Randy Kramer (PS: The second program is in C for OS/2, but includes the source, so could be useful on other platforms.) Brendan wrote: I seem to remember seeing it somewhere...Let me go look for it... Hm, if you speak Spanish, here is something for man2txt: #!/usr/bin/perl #Por C2H5OH (aka etanol). #Copyleft 2001. GNU General Public License. #Comunicar bugs a [EMAIL PROTECTED] sub muestra_ayuda { print Sintaxis: \tman2txt alias outfile\n; print \t- alias: es el nombre de la página man (p.e: fork).\n; print \t- outfile: el nombre del fichero de salida en formato texto.\n; print \n; exit(1); } #Pal que no entienda esto: man man; man bash open (IN, man -P \cat -v\ $ARGV[0] 2/dev/null |) and open (OUT, $ARGV[1]) or muestra_ayuda; while (IN) { s/.\^H//g; s/M\-{2}/\-/; print OUT; } close IN; #Y ya que tenemos buenos modales ;) close OUT; Found here: http://bulmalug.net/body.phtml?nIdNoticia=1028 Got to love the penguin picture... Another page had this: http://www.filelibrary.com/Contents/DOS/22/9.html Looks like Windows programs... Or, this command could work: man [progname] | col -b progname.man.txt Found this somewhere else: #!/bin/csh man $1 | 2txt $1.txt Or, you could try this guys aliases: http://www.jttk.zaq.ne.jp/sagawa/html/pc/dot/.csh.aliases And this guy has some good utils on his page: http://www.geocities.com/jasonpell/oldprograms.html Hope all of this helps... Tell me how it comes out... Brendan Brendan wrote: # ./man2txt umlug.1x.txt | less Brendan, Thanks for this! Where did you find man2txt. It seems to not be installed on Mandrake 8.1 with the selection I made, and although I found a man page for it on the internet, I haven't, so far, found a place to download it. Randy Kramer Want to buy your Pack or Services from MandrakeSoft? Go to http://www.mandrakestore.com --- Want to buy your Pack or Services from MandrakeSoft? Go to http://www.mandrakestore.com Want to buy your Pack or Services from MandrakeSoft? Go to http://www.mandrakestore.com
Re: Fw: [newbie] making a file from a man doc
I seem to remember seeing it somewhere...Let me go look for it... Hm, if you speak Spanish, here is something for man2txt: #!/usr/bin/perl #Por C2H5OH (aka etanol). #Copyleft 2001. GNU General Public License. #Comunicar bugs a [EMAIL PROTECTED] sub muestra_ayuda { print Sintaxis: \tman2txt alias outfile\n; print \t- alias: es el nombre de la página man (p.e: fork).\n; print \t- outfile: el nombre del fichero de salida en formato texto.\n; print \n; exit(1); } #Pal que no entienda esto: man man; man bash open (IN, man -P \cat -v\ $ARGV[0] 2/dev/null |) and open (OUT, $ARGV[1]) or muestra_ayuda; while (IN) { s/.\^H//g; s/M\-{2}/\-/; print OUT; } close IN; #Y ya que tenemos buenos modales ;) close OUT; Found here: http://bulmalug.net/body.phtml?nIdNoticia=1028 Got to love the penguin picture... Another page had this: http://www.filelibrary.com/Contents/DOS/22/9.html Looks like Windows programs... Or, this command could work: man [progname] | col -b progname.man.txt Found this somewhere else: #!/bin/csh man $1 | 2txt $1.txt Or, you could try this guys aliases: http://www.jttk.zaq.ne.jp/sagawa/html/pc/dot/.csh.aliases And this guy has some good utils on his page: http://www.geocities.com/jasonpell/oldprograms.html Hope all of this helps... Tell me how it comes out... Brendan Brendan wrote: # ./man2txt umlug.1x.txt | less Brendan, Thanks for this! Where did you find man2txt. It seems to not be installed on Mandrake 8.1 with the selection I made, and although I found a man page for it on the internet, I haven't, so far, found a place to download it. Randy Kramer Want to buy your Pack or Services from MandrakeSoft? Go to http://www.mandrakestore.com Want to buy your Pack or Services from MandrakeSoft? Go to http://www.mandrakestore.com
Re: Fw: [newbie] making a file from a man doc
Brendan wrote: # ./man2txt umlug.1x.txt | less Brendan, Thanks for this! Where did you find man2txt. It seems to not be installed on Mandrake 8.1 with the selection I made, and although I found a man page for it on the internet, I haven't, so far, found a place to download it. Randy Kramer Want to buy your Pack or Services from MandrakeSoft? Go to http://www.mandrakestore.com
Re: Fw: [newbie] making a file from a man doc
#!/bin/sh # ./man2txt umlug.1x.txt | less nroff -man | perl -pe 's/\cH.//g' | uniq # s,.\x08,,g; # Robert Schmertz http://www.geocities.com/rschmertz/ #Though we don't have any underlines in our man page, this might not work #with underlines, since I've found that the underscore is usually printed #before the letter that is underlined. The result is that the underlines #get printed instead of the letters/words being underlined. So you might #want to switch \cH and '.'. I even thought of making it a 3-stage #process (get rid of ^H_, then _^H, and THEN .^H) just to cover all #possibilities. #also make sure to remove the page division page 1 - page 2. Want to buy your Pack or Services from MandrakeSoft? Go to http://www.mandrakestore.com
Re: Fw: [newbie] making a file from a man doc
Walter Logeman wrote: In other words, I'd like to convert the text output from what comes out of col -b into something that would have each paragraph on a single long line so I can easily copy and paste it into a wiki. To piggy back on this... I used an editor in Windows called Textpad which allowed me to easily remove all the par endings. or reformat to a new line length. The editors i have tried Kate and Kwrite do not seem to have this option ... is there one around? I know... emacs - but I am not in the space to learn a new system... so far there are only two programs I miss from Windows - Textpad and Forte Agent - I am sure there are better ones here anyway, just have not found them. Walter (or anyone), I'm not familiar with Textpad so I'm curious about how it does that -- in Word I use search and replace to get rid of paragraph endings -- depending on what's in the document. In other words, I look at it with the view hidden text option on, and then I may do things like: (a sequence): * replace all ^p^p (two paragraph marks in a row) with %% (some odd symbols not used in the document) * replace all ^p (a single paragraph mark) with * replace all %% with ^p I wrote the above from memory -- I might have found some better ways, but can't recall at this time -- there usually is some manual cleanup to do. or, under other circumstances, * replace (4 spaces) with Again, at times I'll go further, like then replacing . with . (or something like that) -- again, there is manual clean up to do. The best editor I've found so far in Linux (IMHO) is nedit which includes search and replace using regular expressions, macros, and (incidentally), some ways to vary the wrapping of a line (I've only used what they call continuous wrap (I call it soft wrap) -- it wraps the text to the width of the screen while in nedit, not permanently -- in other words it does not insert any paragraph marks. Usually I still do the changes described above in Word, but nedit is certainly capable of them. Does Textpad have some better magic? Can you describe it or point to a link? Thanks, Randy Kramer PS: Nedit is included in Mandrake, 7.2 and 8.1, but was not installed by default on my last 8.1 install. IIRC, on a previous install I did find it on the disks and manually installed it after the install. Unfortunately, nedit looks a little klunky because it is based on lesstif and the lesstif widget set -- not as spiffy as a typical kde application. Some things are a little tricky -- it took a little learning on my part to be able to repeat a search and replace -- I had to learn to click the Keep Dialog checkbox before doing the first search -- otherwise, IIRC, it disappears and clears the search and replace strings. Also, the idiom of search and replace was a little strange to me (different than what I'm used to) -- after you find and replace the first instance, it doesn't automatically find the next instance -- you have to click find again. Now I'm wondering why I consider this my favorite editor in Linux (and I haven't checked them all). It shows black text on a white background by default. (Things like Cool Edit, IIRC, had some hard to read color combinations by default.) It has the soft wrap feature (few other editors had that). It has macros (few other editors had that). It has regular expression search and replace (I think several other editors had that). My search was a fairly quick comparison of the editors installed by default on Mandrake 7.2 -- these included kedit, kwrite, the k binary editor, cooledit, gedit, xedit, yudit. I ignored vim and emacs (I learned the important part of vim in an earlier experience (:q), and the important part of emacs (don't start it) ;-) -- I also ignored the command line editors like joe, jstar, pico -- I do use joe and jstar at the command line. (I may have sold pico short, but I heard it described as a simple editor -- I was looking for a full featured editor.) Want to buy your Pack or Services from MandrakeSoft? Go to http://www.mandrakestore.com
Re: Fw: [newbie] making a file from a man doc
Gerald Waugh wrote: Try it like this, worked for me as I had the same trouble. $ man urpmi| col -b urpmi.txt Thanks -- I'm not the original poster that worked well. Now a followup question: Is there a similar command to filter out all the multiple spaces? In other words, I'd like to convert the text output from what comes out of col -b into something that would have each paragraph on a single long line so I can easily copy and paste it into a wiki. I guess I can do an awk or sed script (oh,no, something else to learn), but I wondered if maybe somebody has already written a program to deal with this. I tried apropos filter but didn't find anything so far (still reading man pages). Randy Kramer Want to buy your Pack or Services from MandrakeSoft? Go to http://www.mandrakestore.com
Re: Fw: [newbie] making a file from a man doc
Should be man XXX | col -b XXX.txt THANKS! Want to buy your Pack or Services from MandrakeSoft? Go to http://www.mandrakestore.com
Re: Fw: [newbie] making a file from a man doc
try man XXX|col -b|XXX.txt Sounds good , but alas did not work for me as you can see i get a file with nothing in it. What am I missing? 909 walter@psybernet:~ (03:13:50) $ man urpmi|col -b|urpmi.txt 910 walter@psybernet:~ (03:14:17) $ ls urpmi* -l -rw-r--r--1 walter walter 0 Feb 9 15:14 urpmi.txt 911 walter@psybernet:~ (03:14:34) Want to buy your Pack or Services from MandrakeSoft? Go to http://www.mandrakestore.com
Re: Fw: [newbie] making a file from a man doc
On Friday 08 February 2002 09:18 pm, Walter Logeman wrote: try man XXX|col -b|XXX.txt Sounds good , but alas did not work for me as you can see i get a file with nothing in it. What am I missing? Try it like this, worked for me as I had the same trouble. $ man urpmi| col -b urpmi.txt - Gerald Waugh Want to buy your Pack or Services from MandrakeSoft? Go to http://www.mandrakestore.com
Re: Fw: [newbie] making a file from a man doc
cool! i was finding a solution to this one a couple of months ago. btw, you could omit the last pipe as it is a little bit redundant. thanks! On Fri, 8 Feb 2002 09:32:27 +0800 hinet [EMAIL PROTECTED] revealed these words to me: try man XXX|col -b|XXX.txt - Original Message - From: Walter Logeman [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Friday, February 08, 2002 5:58 AM Subject: [newbie] making a file from a man doc I am trying to make a file from a man doc that I can then print or view in an editor. 848 walter@psybernet:~ (10:51:52) $ man urpmi manurpmi this creates the file however it has strange formatting: O OP PT TI IO ON NS S - -- -h he el lp p print an help message and exit. - -- -u up pd da at te e use only update media. What is a more effectiveway of doing this? Walter Want to buy your Pack or Services from MandrakeSoft? Go to http://www.mandrakestore.com -- Programming, an artform that fights back. = Anuerin G. Diaz Design Engineer Millennium Software, Incorporated 2305 B West Tower, Philippines Stocks Exchange Center, Exchange Road, Ortigas Center, Pasig City Tel# 638-3070 loc. 72 Fax# 638-3079 = Want to buy your Pack or Services from MandrakeSoft? Go to http://www.mandrakestore.com