grep递归压缩文件列表中的模式 [英] grep a pattern in list of zip files recursively
本文介绍了grep递归压缩文件列表中的模式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在命令行上使用以下命令来获取模式匹配的行。
I am using the following command on command line for getting the pattern matched lines.
find . -name "*.gz"|xargs gzcat|grep -e "pattern1" -e "pattern2"
我现在只需要查找存在模式的文件名。
我如何在命令行上做到这一点?
i need now to find only the file names where the pattern is present. how can i do it on command line?
grel -l </ code>没有用,因为我是在
grep
推荐答案
for i in $(find . -name "*.gz"); do gzcat $i|grep -qe "n1" -e "n2" && echo $i; done
这篇关于grep递归压缩文件列表中的模式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文