LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
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 05-24-2009, 01:26 PM   #1
stf92
Senior Member
 
Registered: Apr 2007
Location: Buenos Aires.
Distribution: Slackware
Posts: 3,285

Rep: Reputation: 49
Converting html to ascii?


Hi:
GNU, Slack 12.
Is there a gnu utility to transform html to plain ascii?
Any sgestion would be gladly received. Thanks for reading.
 
Old 05-24-2009, 02:17 PM   #2
bathory
Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 10,975

Rep: Reputation: 1343Reputation: 1343Reputation: 1343Reputation: 1343Reputation: 1343Reputation: 1343Reputation: 1343Reputation: 1343Reputation: 1343Reputation: 1343
You can use lynx:
Code:
lynx -dump file.html > file.txt
 
Old 05-24-2009, 03:25 PM   #3
knudfl
LQ 5k Club
 
Registered: Jan 2008
Location: Copenhagen, DK
Distribution: pclos2014.08, Slack14.1 DebWheezy, +50+ other Linux OS, for test only.
Posts: 14,279

Rep: Reputation: 2664Reputation: 2664Reputation: 2664Reputation: 2664Reputation: 2664Reputation: 2664Reputation: 2664Reputation: 2664Reputation: 2664Reputation: 2664Reputation: 2664
I prefer this script

http://comp.eonworks.com/scripts/
http://comp.eonworks.com/scripts/html2txt
http://comp.eonworks.com/scripts/html2txt.gz

Simpler command : 'html2txt <file.html>'
will save the text file as <file.txt>
.....
Attached Files
File Type: txt html2txt.txt (3.0 KB, 4 views)
 
Old 05-24-2009, 05:32 PM   #4
stf92
Senior Member
 
Registered: Apr 2007
Location: Buenos Aires.
Distribution: Slackware
Posts: 3,285

Original Poster
Rep: Reputation: 49
Thank you so much. I made 'slocate -i html2' and got no results, but I didn't make a complete installation. Your script ends up doing same thing as bathory's command but, not only is it very didactic but also more powerful. So, I'd
very much like to have a means of running it line by line (debugging). Is that possible? Regards.

E.S.
 
Old 05-25-2009, 07:04 AM   #5
H_TeXMeX_H
Guru
 
Registered: Oct 2005
Location: $RANDOM
Distribution: slackware64
Posts: 12,928
Blog Entries: 2

Rep: Reputation: 1269Reputation: 1269Reputation: 1269Reputation: 1269Reputation: 1269Reputation: 1269Reputation: 1269Reputation: 1269Reputation: 1269
Why not just use a text editor search and replace ... that does it line-by-line ... takes forever, but it's line-by-line.
 
Old 05-25-2009, 09:13 AM   #6
AwesomeMachine
Senior Member
 
Registered: Jan 2005
Location: USA and Italy
Distribution: Debian jessie/sid; OpenSuSE; Fedora
Posts: 1,593

Rep: Reputation: 162Reputation: 162
There's a gizillion java jar files for stripping formatting out of html, and leaving the text. Seriously, html is text, albeit not plain English prose. It's the web browser that puts the spin on html. And I agree, when I want stripped out html, I use search and replace in a text editor. That leaves the text part roughly the way it was.
 
Old 05-25-2009, 07:07 PM   #7
stf92
Senior Member
 
Registered: Apr 2007
Location: Buenos Aires.
Distribution: Slackware
Posts: 3,285

Original Poster
Rep: Reputation: 49
Very helpful of you. Now, having solved the HTML conversion problem, I'm now interested in script writing itself. And taking knudfl's script as a starting point, I would like to study it. For that purpose, being able to debug it would be great fun.
There's many tutorials around there. Also, the shell man page, which is huge. And I'm a little lazy or rather impatient. So, beginning some point at the middle, is what I
aim at. And the question? How to debug a script. Oh, yes. I know little more than nothing about shell scripts.

Regards.

Last edited by stf92; 05-25-2009 at 07:21 PM. Reason: courtesy
 
Old 05-26-2009, 01:06 PM   #8
H_TeXMeX_H
Guru
 
Registered: Oct 2005
Location: $RANDOM
Distribution: slackware64
Posts: 12,928
Blog Entries: 2

Rep: Reputation: 1269Reputation: 1269Reputation: 1269Reputation: 1269Reputation: 1269Reputation: 1269Reputation: 1269Reputation: 1269Reputation: 1269
Well there's the usually places to learn bash:

http://tldp.org/HOWTO/Bash-Prog-Intro-HOWTO.html
http://tldp.org/LDP/Bash-Beginners-Guide/html/
http://tldp.org/LDP/abs/html/
http://www.grymoire.com/Unix/

I learned mostly from 'Sams teach yourself shell programming in 24 hours', I don't really know too much about its status (free or otherwise), but I got it for free online.
 
Old 05-26-2009, 01:09 PM   #9
senseproof
Member
 
Registered: May 2009
Distribution: Fedora 10
Posts: 31
Blog Entries: 5

Rep: Reputation: 16
w3m -dump does the same like lynx but imho better.
 
Old 05-26-2009, 01:51 PM   #10
stf92
Senior Member
 
Registered: Apr 2007
Location: Buenos Aires.
Distribution: Slackware
Posts: 3,285

Original Poster
Rep: Reputation: 49
Thanks a lot. E.S.
 
Old 05-26-2009, 08:14 PM   #11
chrism01
Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.6, Centos 5.10
Posts: 16,324

Rep: Reputation: 2041Reputation: 2041Reputation: 2041Reputation: 2041Reputation: 2041Reputation: 2041Reputation: 2041Reputation: 2041Reputation: 2041Reputation: 2041Reputation: 2041
This is also very good: http://rute.2038bug.com/index.html.gz
 
Old 05-28-2009, 12:09 PM   #12
stf92
Senior Member
 
Registered: Apr 2007
Location: Buenos Aires.
Distribution: Slackware
Posts: 3,285

Original Poster
Rep: Reputation: 49
Thanks, chrism01.
 
  


Reply

Tags
ascii, html, scripts


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Converting extended ascii (,) in bash script Hko Programming 4 12-29-2012 04:42 AM
Assembly language? converting ascii to decmial matt123 Programming 6 04-27-2009 02:15 AM
Converting ISO-8859-1 to plain ASCII hsocasnavarro Linux - Software 9 12-18-2007 12:49 AM
Converting float to ascii in C C_to_be Programming 2 10-29-2007 07:41 PM
Converting ASCII to Binary? Darx Linux - Software 0 04-08-2004 11:43 AM


All times are GMT -5. The time now is 03:21 PM.

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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration