Skip to content

Instantly share code, notes, and snippets.

@yanofsky
Created August 25, 2013 21:28
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 yanofsky/6336441 to your computer and use it in GitHub Desktop.
Save yanofsky/6336441 to your computer and use it in GitHub Desktop.
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
@yanofsky
Copy link
Author

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