How to Get All Email Addresses From a Bunch of Word Files

It sounds difficult, but in fact it’s pretty easy:

#!/bin/bash

for FILE in *.docx
do
:
EMAIL=$(unzip -qco "$" word/document.xml | grep  -E -o "\b[a-zA-Z0-9.-]+@[a-zA-Z0-9.-]+\.[a-zA-Z0-9.-]+\b")

echo $EMAIL
echo $FILE
echo
echo "---"
echo
echo "$EMAIL," >> emails.txt
done
comments powered by Disqus