aboutsummaryrefslogtreecommitdiffstats
path: root/.mutt/excel2text.sh
diff options
context:
space:
mode:
authorAaron LI <aaronly.me@gmail.com>2016-01-06 19:15:10 +0800
committerAaron LI <aaronly.me@gmail.com>2016-01-06 19:15:10 +0800
commit028ab301fe80c9ed872fe8ba4be2819648e30d97 (patch)
treee3788bddd4bc9732577cde23c5c8a38824ddbc8d /.mutt/excel2text.sh
parent6f2380babe7dcfb204937f0f734443a6c854106f (diff)
downloaddotfiles-028ab301fe80c9ed872fe8ba4be2819648e30d97.tar.bz2
Add fish & redshift configs; Update gpg configs; Add mutt scripts
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.
+'