使用grep进行文本查找

命令模式:

grep "文本" -rl 路径

例子:

grep "w3.the.abc.com" -rl /home/hy/fluent3

有时候需要排除掉一些文件,比如SVN的svn-base文件,可以用管道进行二次过滤:

grep "w3.the.abc.com" -rl /home/hy/fluent35 | grep -v '.svn-base'

这样,包括w3.the.abc.com的文件里,后缀是svn-base的就被排除了。

find -name '*.xml'|xargs grep 'org.apache.catalina.valves.AccessLogValve'      // 在当前路径及子目录的xml文件中寻找 org.apache.catalina.valves.AccessLogValve

原文地址:https://www.cnblogs.com/heyang78/p/3376504.html