Advertisement
Guest User

documentinfo

a guest
Feb 19th, 2012
643
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.74 KB | None | 0 0
  1.  
  2. #!/bin/bash
  3. # documentinfo, gives document info about a LibreOffice document.
  4. # Created: 2012-02-19
  5. #
  6. # uses: xml, from http://xmlstar.sourceforge.net/
  7. #
  8.  
  9. if [ ! -e $1 ] || [[ "$1" == "" ]]; then
  10. echo "Usage: `basename $01` <filename>"
  11. exit 1
  12. fi
  13.  
  14. if [ -e "meta.xml" ]; then
  15. echo "Sorry, this cannot be done because some 'meta.xml' already exists"
  16. else
  17. # extract 'meta.xml' from the inputfile
  18. unzip -qo $1 meta.xml
  19.  
  20. for f in `xml el meta.xml`;
  21. do
  22. n=${f/*:}
  23. if [[ ! "$n" =~ "meta" ]]; then
  24. w=`xml sel -t -v "$f" meta.xml`
  25. echo "$n: $w"
  26. fi
  27. done
  28. rm meta.xml
  29. fi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement