Converting html to text
Martin Maney <[email protected]> Sat, 23 Apr 2011 19:24:58 -0500
| Newsgroups | gmane.org.user-groups.luni.tech |
|---|---|
| Message-ID | <[email protected]> |
This reminds me of something I was looking for the other day. I prefer to read email in text mode, but occasionally I have to dig the couple lines of information out of a thousand lines of tortured HTML (why is it that these things are always the worst sort of old-school HTML hacks, full of zero-width images and other trash?). At some time in the past there was a little CLI filter named hmtl2txt (or something like that) that I would use... at some upgrade it went missing, not sure when. The other day I wanted it enough to poke around, and I ended up with this one-line shell script: w3m -dump -T text/html Okay, two lines with standard #! header when saved to ~/bin so I don't have to type all that. I suppose I could attach it to mutt more intimately, but it's occasionally useful outside the email reader. (I think the previous html2txt went missing because it was built around a similar use of lynx, which is no longer commonly installed. The above is not as general as the older tool - it only works as a filter and doesn't allow any of the gazillion options w3m does. Perfect!) -- River lines, defensible passes, the posession of hills and encirclement of cities; these are the syntax that structures the speech of guns. -- John M. Ford -- Linux Users Of Northern Illinois (Chicago) - Technical Discussion http://luni.org/mailman/listinfo/luni