【发布时间】:2018-06-27 10:54:08
【问题描述】:
我有一堆同名的文本(输入)文件
foo_bar_abc_1_01_geh_file.in
foo_bar_abc_1_02_geh_file.in
foo_bar_abc_1_03_geh_file.in
...
...
foo_bar_abc_1_1000_geh_file.in
我使用以下命令来运行这些多个作业(在 HPC 集群中)
for f in foo*.in; do qsub -N test -v infile=$f run.pbs
这个单行脚本的问题是队列中的所有作业的作业名称(在集群中)都是相同的(即,测试是所有作业的名称)。
我想将每个作业命名为 test01、test02、test03...test1000(从相应文件名中提取/提取的数字。例如,
#For foo_bar_abc_1_01_geh_file.in, the Job Name should be test01,
#For foo_bar_abc_1_02_geh_file.in, the Job Name should be test02,
#For foo_bar_abc_1_100_geh_file.in, the Job Name should be test100,
etc.
这个是bash怎么做的?
【问题讨论】: