Skip to content

Instantly share code, notes, and snippets.

@midwire
Last active February 9, 2016 15:14
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save midwire/e8c5ec4cf40f06ba24a7 to your computer and use it in GitHub Desktop.
Save midwire/e8c5ec4cf40f06ba24a7 to your computer and use it in GitHub Desktop.
Fix Old Pages Documents
#!/usr/bin/env bash
# fix_pages_doc.sh /path/to/document.pages
# See: https://apple.stackexchange.com/questions/150771/how-do-i-convert-old-pages-documents-to-pages-13
FILE="$1"
if [ ! -r "$FILE" ]; then
echo "File does not exist: [$FILE]"
exit 1
fi
cd "$FILE"
gunzip --stdout index.xml.gz | sed 's-:version="72007061400"-:version="92008102400"-g' > index.xml
mv index.xml.gz /tmp
cd -
echo "Your .pages file: [$FILE] has been fixed."
open "$FILE"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment