如何使“grep”从文件中读取模式? [英] How to make "grep" read patterns from a file?

查看:99
本文介绍了如何使“grep”从文件中读取模式?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

假设有一个大的文本文件,我想只打印不符合某些模式的行。显然,我可以使用 egrep -v'patter1 | pattern2 | pattern3 。现在如果所有这些模式都在一个文本文件中呢?什么是使 egrep 从文件中读取模式的最佳方式?

pre> grep -v -f pattern_file




Suppose there is a large text file and I would like 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

这篇关于如何使“grep”从文件中读取模式?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆