Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/amazon-s3/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何在Bash中创建循环来搜索一组.gz文件_Bash - Fatal编程技术网

如何在Bash中创建循环来搜索一组.gz文件

如何在Bash中创建循环来搜索一组.gz文件,bash,Bash,我正在开发OS X El Capitan V10.11.3 我能够使用测试文件的语法,但在一组.gz文件上使用它却很困难 处理测试文件: #!/bin/bash while read p; do grep $p test2.txt>> final.txt done <test3.txt #/bin/bash 读p;做 grep$p test2.txt>>final.txt 完成我在同一个平台上,但无法使用您的语法-这似乎达到了预期的效果(称为findString.sh):

我正在开发OS X El Capitan V10.11.3

我能够使用测试文件的语法,但在一组.gz文件上使用它却很困难

处理测试文件:

#!/bin/bash
while read p; do
  grep $p test2.txt>> final.txt
done <test3.txt
#/bin/bash
读p;做
grep$p test2.txt>>final.txt

完成我在同一个平台上,但无法使用您的语法-这似乎达到了预期的效果(称为findString.sh):

当你像这样跑步时:

./findString.sh < test3.txt
/findString.sh

不确定我是否走上了正确的道路,但似乎很有效。注意:我必须使用gzcat来读取gzipped文件,zcat正在寻找*.Z

我在同一个平台上,但无法使用您的语法-这似乎达到了预期的结果(称为findString.sh):

当你像这样跑步时:

./findString.sh < test3.txt
/findString.sh
不确定我是否走上了正确的道路,但似乎很有效。注意我必须使用gzcat来读取gzipped文件,zcat正在寻找*.Z

./findString.sh < test3.txt