I downloaded very huge list of hosts to block ads. The problem is some sites are broken its functionality, like forum/discussion and/or pics. So i wanna remove some sites in hosts file.
Let say I wanna remove a.com and b.com from hosts. These methods work.
grep -ve a.com -e b.com hosts > new_hosts
or
egrep -v 'a.com|b.com' hosts > new_hosts
Both are working fine. But if pattern increase, I wanna write the pattern in file. If I use this
grep -vf pattern.txt hosts > new_hosts
Only the last pattern will be removed. If pattern.txt contain
a.com
b.com
Only b.com omitted from new_hosts, a.com still written in new_hosts. So what grep command to use using pattern file?