Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
A script to anonymize a Word document's track changes.
#change the working directory to the Desktop
cd ~/Desktop
#unzip the word doc into a new directory called anonDocument
unzip myDocument.docx -d anonDocument/
#search all of the files in the word doc package and replace any comment or track changes author with anonymous edit
grep -rl "w:author" ./anonDocument | xargs sed -i '' 's/w:author="[a-zA-Z0-9 ]*"/w:author="anonymous edit"/g'
#change the working directory to the anonDocument directory
cd anonDocument
#create a new word doc on the Desktop called cleanDocument.docx
zip -r ../cleanDocument.docx .
#change the working directory back to the Desktop
cd ..
#remove unzipped document folder from the desktop
rm -r anonDocument
#open the new document
open cleanDocument.docx

This comment has been minimized.

Copy link
Owner Author

@yanofsky yanofsky commented Aug 25, 2013

You can read more about this script on my blog

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.