Commit 0c095bf1 authored by Kirill Smelkov's avatar Kirill Smelkov

doc-astextplain: Simple wrapper around antiword to also cat non-msword documents

Бывают .doc файлы в которых идёт plain-text и antiword на них вылетает с
ошибкой.
parent 1cc12da1
#!/bin/sh
# dump a .doc in astextplain style
# unoconv -f txt --stdout $1
# antiword $1
err=`mktemp -t doc-astextplain.err.XXXXXX`
antiword "$1" 2>"$err"
r=$?
if [ "$r" != 0 ] && grep -q "is not a Word Document" "$err" ; then
# it's just a plain-text .doc
cat "$1"
r=$?
else
cat "$err" 1>&2
fi
rm "$err"
exit $?
......@@ -3,3 +3,5 @@ application/msexcel; xls-astextplain '%s'; copiousoutput
application/vnd.ms-excel; xls-astextplain '%s'; copiousoutput
application/msregedit; reg-astextplain '%s'; copiousoutput
application/msword; doc-astextplain '%s'; copiousoutput
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment