Entering edit mode
4.4 years ago
FGV
▴
170
Dear all,
I am trying to use gnu parallel to run a command, where each command uses one from the first argument and two from the second. I've tried several things but without success.
I'd like to have something like:
parallel "command -t {1} {2} {3} > {1}_{2/..}.out " ::: 4 8 ::: File1 File2 File3 File4
and output:
command -t 4 File1 File2 > 4_File1.out
command -t 8 File1 File2 > 8_File1.out
command -t 4 File3 File4 > 4_File3.out
command -t 8 File3 File4 > 8_File3.out
Is it possible?
thanks,
thanks, that worked!
But can you explain a bit more the logic behind it? I tried using
-N 2
but with{1} {2} {3}
, and that did not work. Why does it work with{4}
?thanks
Sure. As per how I understand it, it is easiest to first print what gnuparallel sees and then cherrypick the argument numbers.
parallel --dry-run -N 2 command -t {} ::: 4 8 ::: File1 File2 File3 File4
will return
From these, the third one needs to be removed to generate the required command format so
{1} {2} {4}
and the output should be redirected to to a file which is{1}_{2}.out
nice trick. :) Thanks,