From a file, containing one email per line, I have tried to remove the domains in the emails using this command:
grep -viwE "(gmail.com|hotmail|yahoo|aol|rediffmail.com|msn|outlook|inbox.com|icloud.com|mail.com|zoho.com|yandex|live.)" * > dest.txt
It is however also removing the emails containing particular terms, similar to what I have given in the brackets.
Say for example the email:
firstname.lastname@example.org should get deleted, but the another emails should not. The above command is deleting both the instances which is not good. How I can avoid it?
Additional complication is that possibly encoding errors will occur.