#!/bin/sh # Unpack an "xml in a zip file" (Oasis OpenDocument or even OOo-1.x) document into a subdir of the same name # Example: oasis_unpack foo.odt, will create a directory named "foo" # Author: David Faure , License: LGPL v2. test $# -gt 0 || { echo "Usage: $0 file"; exit 1; } f="$1" dir=`echo $1 | sed -e 's/\..*$//'` test -f "$f" || { echo "file $f not found"; exit 1; } mkdir "$dir" || exit 1 echo "$dir created" unset CDPATH cd "$dir" unzip "../$f" find . -type f -name '*.xml' | while read i; do xmllint --format "$i" -o xmllint.out && mv -f xmllint.out "$i" done