搜索文件中模式的目录和子目录 [英] Search directory and sub-directories for pattern in a file

查看:119
本文介绍了搜索文件中模式的目录和子目录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在linux中,我想搜索给定的directoy及其子文件夹/文件,以确定是否包含和排除模式。

  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屋!

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