2011-03-30 14:14:36 +00:00
|
|
|
#!/bin/rc
|
|
|
|
|
|
|
|
rfork en
|
|
|
|
|
|
|
|
if(! ~ $#* 0 1) {
|
2020-03-10 17:09:34 +00:00
|
|
|
echo 'usage: doc2txt [file.doc]' >[1=2]
|
2011-03-30 14:14:36 +00:00
|
|
|
exit usage
|
|
|
|
}
|
|
|
|
|
|
|
|
switch($#*){
|
|
|
|
case 0
|
|
|
|
cat >/tmp/doc2txt.$pid
|
|
|
|
file=/tmp/doc2txt.$pid
|
|
|
|
case 1
|
|
|
|
file=$1
|
|
|
|
}
|
|
|
|
aux/olefs $file || {
|
|
|
|
echo 'doc2txt: couldn''t mount word document' >[1=2]
|
|
|
|
rm -f /tmp/doc2txt.$pid
|
|
|
|
exit word
|
|
|
|
}
|
|
|
|
|
|
|
|
if(! test -f /mnt/doc/WordDocument) {
|
|
|
|
echo 'doc2txt: is an msoffice doc but not a word document' >[1=2]
|
|
|
|
rm -f /tmp/doc2txt.$pid
|
|
|
|
exit worddoc
|
|
|
|
}
|
|
|
|
|
|
|
|
aux/mswordstrings /mnt/doc/WordDocument | tcs -f microsoft -t utf |fmt | uniq
|
|
|
|
unmount /mnt/doc
|
|
|
|
rm -f /tmp/doc2txt.$pid
|