aboutsummaryrefslogtreecommitdiffstats
path: root/.mutt/excel2text.sh
diff options
context:
space:
mode:
Diffstat (limited to '.mutt/excel2text.sh')
-rwxr-xr-x.mutt/excel2text.sh31
1 files changed, 31 insertions, 0 deletions
diff --git a/.mutt/excel2text.sh b/.mutt/excel2text.sh
new file mode 100755
index 0000000..c3d0f14
--- /dev/null
+++ b/.mutt/excel2text.sh
@@ -0,0 +1,31 @@
+#!/bin/sh
+#
+# excel2text - convert MS Excel files to ASCII text
+#
+# Written by Gary Johnson <garyjohn@spk.agilent.com>.
+#
+# Modification History:
+# 2003-02-19
+# Changed the name xlHtml to xlhtml to match the xlhtml-0.5
+# release.
+
+prog=${0##*/}
+
+if [ $# -ne 1 ]
+then
+ echo "Usage: $prog file" >&2
+ exit 2
+fi
+
+xlhtml -te "$1" |
+perl -pe 's/>-{21,}</><HR></g' | # This replaces long lines of
+ # hyphens with HTML <HR> tags so
+ # that these lines adapt to the
+ # width of the cell. "21" is a
+ # value that works for the
+ # tables I'm sent.
+w3m -dump -T text/html |
+perl -pe '
+ s/\xa0/ /gs; # Change A0 spaces to ASCII
+ # spaces.
+'