aboutsummaryrefslogtreecommitdiffstats
path: root/dist-tools/html2txt
blob: d2ae59a1d99134aa975a336e59542b2dc208bea1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#! /bin/sh

# html2txt.sh - A program to convert fetchmail's HTML documentation to text
# Copyright (C) 2004  Matthias Andree

# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.

# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.

# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA

# --------------------------------------------------------------------------

# Usage: html2txt.sh INPUT.html

# --------------------------------------------------------------------------

# Abort on error
set -e

# Parse arguments
if [ $# -ne 1 ] ; then
    echo >&2 "Usage: `basename $0 || echo $0` input.html"
    exit 1
fi

# Pull in variables
inp="$1"
tmp="html2txt.$$.html"

# now preprocess
trap "rm -f \"$tmp\"" 0 1 2 3 15
${AWK:=awk} '/<table .*summary="Canned/ { i=1; }
     /<\/table>/ { i=0; }
     { if (i == 0) print $0; }' "$inp" >"$tmp"

# and go!
echo "  (This file was generated from $inp)"
lynx -dump -nolist "$tmp"
rm -f "$tmp"
trap "" 0 1 2 3 15
s not expecting it to be so doggone EASY to get it up and running. Sure surprised me! Of course, it hasn't actually retreived any mail yet, but that's my problem, not yours. Thanks very very much. -- ... _._. ._ ._. . _._. ._. ___ .__ ._. . .__. ._ .. ._. Felix Finch, scarecrow repairer / felix@crowfix.com PGP = 9D 93 1E 78 5B D7 42 1C 95 4E 9E DD 3F 6F 21 98 I've found a solution to Fermat's Last Theorem but I see I've run out of room o </LISTING> (Um, I suppose I should add that he did in fact succeed in getting fetchmail to retrieve his mail.)<P> <HR> <table width="100%" cellpadding=0><tr> <td width="30%">Back to <a href="index.html">Fetchmail Home Page</a> <td width="30%" align=center>To <a href="/~esr/sitemap.html">Site Map</a> <td width="30%" align=right>$Date: 1997/08/05 04:20:56 $ </table> <P><ADDRESS>Eric S. Raymond &lt;esr@snark.thyrsus.com&gt;</ADDRESS> </BODY> </HTML>