开发者

grep a file with a list of regular expressions

开发者 https://www.devze.com 2023-01-08 05:01 出处:网络
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:

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 fileWithManyRegu开发者_StackOverflowlarExpressions fileThatMightMatchSomeRegularExpressions

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


grep -v -f regexes.txt content.txt


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

0

精彩评论

暂无评论...
验证码 换一张
取 消