【问题标题】:Running multiple jobs with unique name using qsub使用 qsub 运行具有唯一名称的多个作业
【发布时间】: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怎么做的?

【问题讨论】:

    标签: bash hpc pbs


    【解决方案1】:

    你可以用cut点赞

    for f in foo*.in; do qsub -N test$(echo $f|cut -d_ -f5) -v infile=$f run.pbs; done
    

    在哪里

    • -d_ 将分隔符设置为 _
    • -f5 仅选择第 5 列(即作业编号)

    【讨论】:

      猜你喜欢
      • 2022-01-27
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多