Skip to content

Instantly share code, notes, and snippets.

@iwat
Last active August 29, 2015 14:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save iwat/dcfef45d91f9200e03ab to your computer and use it in GitHub Desktop.
Save iwat/dcfef45d91f9200e03ab to your computer and use it in GitHub Desktop.
Commit formatted extracted docx into GIT.
#!/bin/sh
if [ "$1" != "" ] && [ "$2" != "" ]; then
FILE=$1
REPO=$1_repo
else
echo "$0 <docx file> <comment>"
exit 1
fi
if [ ! -d "$REPO" ]; then
mkdir "$REPO"
cd "$REPO"
git init .
fi
cd "$REPO"
rm -rf *
unzip "../$FILE"
find . -type f -name "*.xml" -exec xmllint {} -format -output {} \;
find . -type f -name "*.rels" -exec xmllint {} -format -output {} \;
git add --all .
git commit -a -m "$2"
git status
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment