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

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

问题描述

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

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天全站免登陆