Find in a single file:
grep -E -o "\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,6}\b" someFile.txt
When checking in folders, the output will list the matches as filename:email
for every match in a file.
The option --exclude-dir
requires just the name of the folder to exclude, not the whole file path.
Find all in a folder:
grep -E -o -r "\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,6}\b" wwwroot/
File all in a folder, excluding certain folders:
grep -E -o -r --exclude-dir=folder1 --exclude-dir=folder2 "\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,6}\b" wwwroot/