搜索文件中模式的目录和子目录 [英] Search directory and sub-directories for pattern in a file
本文介绍了搜索文件中模式的目录和子目录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
find / apps -exec grepperformance-vwarn{} / dev / null \;
这样可以反映搜索进行时间线的负载。我不想那样,我想找到包含不包含警告的性能的文件。如何做到这一点?
解决方案
find / apps -exec grepperformance{} / dev / null \; | grep -vwarn
通过第二次调用输出到 grep
。
In linux, I want to search the given directoy and its sub-folders/files for certain include and exclude pattern.
find /apps -exec grep "performance" -v "warn" {} /dev/null \;
This echoes loads of lines from which search goes trough. I don't want that, I'd like to find files containing performance which do not contain warn. How do I do that?
解决方案
Very close to what you have already:
find /apps -exec grep "performance" {} /dev/null \; | grep -v "warn"
Just pipe the output through a second call to grep
.
这篇关于搜索文件中模式的目录和子目录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文