[NTLUG:Discuss] Filtering a list with a list

Chris Cox cjcox at acm.org
Fri Mar 6 21:52:11 CST 2009


Daniel Hauck wrote:
> I have a process that generates a list of valid email addresses for a
> system.  I would like to be able to filter that list by removing all
> entries that appear in an exclusion list.
> 

grep has a file option for patterns.
grep -v -f filter.txt list.txt
user1 at domain.com
user2 at domain.com
user3 at domain.com
user4 at domain.com

Assuming list.txt has the whole list and
filter.txt has the exclusion list.



More information about the Discuss mailing list