How can I scan through a file which contains email addresses that are separated by a new line character and get rid of those that belong to a certain domain, e.g. hacker@bad.com
. I want to get rid of all email addresses that are @bad.com
Use grep
instead of Perl
grep -v '@bad\.com' inputfile > outputfile
On Windows
findstr /v "@bad\.com" inputfile > outputfile