我使用此命令成功搜索:从日志目录(压缩文件)中的 txt 文件 ips.txt
搜索可疑 IP 列表。
root@yop# find /mylogs/ -exec zgrep -i -f ips.txt {} \; > ips.result.txt
我现在想使用 parallel 来加速搜索。 我目前无法为其找到正确的参数。我的意思是使用模式文件(每行一个)并将其导出到结果文件中。
请问有没有平行大师?
我找到的更接近的命令是这样的: grep-or-anything-else-many-files-with-multiprocessor-power
但无法将它与模式文件列表一起使用,也无法将结果导出到文件...
请帮忙,谢谢大家。
最佳答案
如果您只想一次运行多个作业,请考虑使用 GNU parallel :
parallel zgrep -i -f ips.txt :::: <(find /mylogs -type f) > results.txt
关于bash - 并行 grep 模式多个文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22012306/