Created
August 25, 2013 21:28
-
-
Save yanofsky/6336441 to your computer and use it in GitHub Desktop.
A script to anonymize a Word document's track changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You can read more about this script on my blog