xls2txt 520 B

1234567891011121314151617181920212223242526272829303132
  1. #!/bin/rc
  2. rfork en
  3. if(! ~ $#* 0 1) {
  4. echo 'usage: xls2txt [file.xls]' >[1=2]
  5. exit usage
  6. }
  7. switch($#*){
  8. case 0
  9. cat >/tmp/xls2txt.$pid
  10. file=/tmp/xls2txt.$pid
  11. case 1
  12. file=$1
  13. }
  14. aux/olefs $file || {
  15. echo 'xls2txt: couldn''t mount excel document' >[1=2]
  16. rm -f /tmp/xls2txt.$pid
  17. exit word
  18. }
  19. if(! test -f /mnt/doc/Workbook) {
  20. echo 'xls2txt: is an MSoffice doc but not an Excel document' >[1=2]
  21. rm -f /tmp/xls2txt.$pid
  22. exit wordxls
  23. }
  24. aux/msexceltables /mnt/doc/Workbook
  25. unmount /mnt/doc
  26. rm -f /tmp/xls2txt.$pid