tags:

views:

43

answers:

2

I have a large file of regular expressions, one per line. I would like to inverse grep another multi-line file against any regular expression that appears in the first file. Something like this:

grep -v fileWithManyRegularExpressions fileThatMightMatchSomeRegularExpressions

Is there an elegant method to do this aside from looping through every regular expression?

+5  A: 
grep -v -f regexes.txt content.txt
SilentGhost
just remember that -v is applied AFTER any matches, so effectively it's negation of the union of regexs, not the union of the negatives of regexs.
Elf King
A: 

At least with Gnu grep you can use --file=<filename> and all should be well.

Jerry Coffin