Skip to content

Instantly share code, notes, and snippets.

@knthls
Created February 25, 2020 12:13
Show Gist options
  • Save knthls/e24428aae930417ca73e5defd271e2e6 to your computer and use it in GitHub Desktop.
Save knthls/e24428aae930417ca73e5defd271e2e6 to your computer and use it in GitHub Desktop.
Inspect document xml for docx file
#/bin/bash
wd=$(mktemp -d)
docx_file=$1
if [ -z $docx_file ]; then
echo "Usage: inspect_docx.sh []"
fi
if [ -z $EDITOR ]; then
EDITOR=nvim
fi
if [ -f $docx_file ]; then
cp test.docx "$wd/test.zip"
unzip "$wd/test.zip" -d $wd
cat $wd/word/document.xml | xmllint --format - | $EDITOR
rm -r $wd
else
echo "no such file $docx_file"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment