gnu并行

时间:2017-11-09 09:42:40

标签: shell gnu-parallel

是否有可能让GNU并行调用一次多个参数的命令,达到某个限制?

只是为了解释,一个简单的例子......

制作一些文件: seq 10 | parallel touch test_files{}.txt

要删除它们,我可以执行:rm ./test_files*.txt

或等效于GNU parallel:ls ./test_files*.txt | parallel rm, 每个文件运行一次rm

有没有办法告诉GNU parallel使用最大数量的参数运行命令,比如......

ls ./test_files*.txt | parallel --max-args 5 rm

将启动

rm test_files1.txt test_files2.txt test_files3.txt test_files4.txt test_files5.txt
rm test_files6.txt test_files7.txt test_files8.txt test_files9.txt test_files10.txt

1 个答案:

答案 0 :(得分:1)

$ seq 10 | parallel --max-args 5 echo
1 2 3 4 5
6 7 8 9 10