1
0

doc2txt 563 B

12345678910111213141516171819202122232425262728293031
  1. #!/bin/rc
  2. rfork en
  3. if(! ~ $#* 0 1) {
  4. echo 'Usage: doc2txt [file.doc]' >[1=2]
  5. exit usage
  6. }
  7. switch($#*){
  8. case 0
  9. cat >/tmp/doc2txt.$pid
  10. file=/tmp/doc2txt.$pid
  11. case 1
  12. file=$1
  13. }
  14. aux/olefs $file || {
  15. echo 'doc2txt: couldn''t mount word document' >[1=2]
  16. rm -f /tmp/doc2txt.$pid
  17. exit word
  18. }
  19. if(! test -f /mnt/doc/WordDocument) {
  20. echo 'doc2txt: is an msoffice doc but not a word document' >[1=2]
  21. rm -f /tmp/doc2txt.$pid
  22. exit worddoc
  23. }
  24. aux/mswordstrings /mnt/doc/WordDocument | tcs -f microsoft -t utf |fmt | uniq
  25. unmount /mnt/doc
  26. rm -f /tmp/doc2txt.$pid