#> find . -type f -exec grep 'mingtian' -l {} \;
grep -l :是显示匹配的内容的文件名字!
或者:
#> find . -type f -name "*.*" |xargs grep 'xiaoshou' -l
grep -l :是显示匹配的内容的文件名字!
或者:
#> find . -type f -name "*.*" |xargs grep 'xiaoshou' -l
(这个方法 不好,挺乱的,还慢,推荐前一个方法!)
转自:http://blog.chinaunix.net/space.php?uid=7491192&do=blog&id=2051140
本文介绍了两种在Linux系统中查找特定文件内容的方法:使用find结合grep进行精确搜索,以及通过find定位文件后再用xargs传递给grep的方式。推荐使用前者因其更为高效。

21万+

被折叠的 条评论
为什么被折叠?



