I have found a long list of free email providers that I want to remove from my email lists - https://gist.github.com/tbrianjones/5992856
Below are two commands I currently use that do the same job for a handful or single domain entries however how can I convert these to import the words from another file? remove.txt
for example rather than adding all of them manually.
ruby -rcsv -i -ne 'row = CSV::parse_line($_); puts $_ unless row[2] =~ /gmail|hotmail|qq.com|yahoo|live.com|comcast.com|icloud.com|aol.co/i' All.txt
sed -i '/^[^,]*,[^,]*hotmail/d' All.txt
Below is a line of the data we will be using this on
"fox*******","scott@sc***h.com","821 Ke****on Rd","Neenah","Wisconsin","54***6","UNITED STATES"
grep -ivf-
– mikeserv Jul 18 '15 at 02:35grep
s on a subset of the match against list. Quicker still would be to use-F
ixed-string matches, but in that case you wouldn't be able to anchor and could only do:grep . remove.txt | grep -ivFf- All.txt
, but in the latter case you'd drop all occurrences of any match inremove.txt
no matter where it was made in your string. Safely you might split out your file to only the matchable bits:sed -ne's/[^@]*@\([^,]*\).*/\1/p' <All.txt | grep -iFxnf remove.txt | sed 's/:.*/d/' | sed -f- All.txt >out
– mikeserv Jul 18 '15 at 18:23grep
has to check against per line the better. – mikeserv Jul 18 '15 at 18:31