开发者

How to make "grep" read patterns from a file?

Suppose there is a large text file and I would lik开发者_开发技巧e to print only the lines that do not match some patterns. Obviously, I can use egrep -v 'patter1|pattern2|pattern3. Now what if all those patterns are in a text file ? What is the best way to make egrep read patterns from the file ?


grep -v -f pattern_file


egrep has an -f option which does exactly that: you specify a file, and it reads patterns from that file, one per line.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜