在多个文件上运行脚本 [英] Run script on multiple files
本文介绍了在多个文件上运行脚本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
I would like to execute a script on a batch of files all of which have .xml extension.
受以前的帖子启发,我尝试了以下操作:
Inspired by previous posts, I tried the following:
for file in *.xml; do ./script.sh <"$file"; done
还有
for i in $(\ls -d *.xml)
do
./script.sh -i /path/*.xml -d /output_folder $i
done
这两个脚本多次运行脚本,但仅在该文件夹中的第一个.xml文件上运行.因此,我最终得到了一打输出文件,但它们都是file1.txt,file1.txt_1,file1.txt_2等.循环随机停止,有时在3次迭代之后,有时在28次之后.
Both of these run the script many times but only on the first .xml file in that folder. So I end up with a dozen output files but all of them are file1.txt, file1.txt_1, file1.txt_2 etc. The loop stops randomly, sometimes after 3 iterations, sometimes after 28.
任何帮助,我们将不胜感激,谢谢,TP
Any help would be appreciated, Thank you, TP
推荐答案
for f in /input_path/*.xml; do
./interproscan.sh -mode convert -f raw -i "$f" -d /output_path
done
这篇关于在多个文件上运行脚本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文