GNU Parallel:如何将作业 ID 传递给命令

GNU Parallel: how to pass job id to command

假设我 运行 gnu 并行处理从标准输入中接收的项目数组,并根据某些标准拆分:

cat content | parallel -j 4 my_command

如何访问作业编号,以便我可以将并行执行的作业 number/id 作为参数传递给命令(以便每个并行执行块都有一个唯一编号):

cat content | parallel -j 4 my_command -n ???

(这甚至可能吗?目前正在查看手册页)

您正在寻找替换字符串{#}

cat content | parallel -j 4 my_command -n {#}

金手指上也提到了sheet:https://www.gnu.org/software/parallel/parallel_cheat.pdf