Linux 如何在grep中指定忽略模式?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/4068983/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-04 23:51:40  来源:igfitidea点击:

How to specify ignore pattern in grep?

linuxgrepdesign-patternsignore

提问by Vahagn

How can I make grep to ignore some files (e.g. .svn directories, binary files, etc.) while grepping recursively?

如何让 grep 在递归 grep 时忽略某些文件(例如 .svn 目录、二进制文件等)?

采纳答案by Gareth Davidson

Use an --exclude pattern as already answered here

使用已在此处回答的 --exclude 模式

回答by darioo

Use ack.

使用ack