':::+'

Uit De Vliegende Brigade
Naar navigatie springen Naar zoeken springen

With ::: you get the Cartesian product of the variables. If you don't want that, use :::+. See examples elsewhere about parsing an associative array with three columns into Parallel.

ChatGPT - 2023.09

In GNU parallel, the operator :::+ is used for combining arguments from different input sources so that they are used together in a single command.

Let's say you have two sets of input:

List1: A B C
List2: 1 2 3

If you use :::+, parallel will execute commands like this:

command A 1
command B 2
command C 3

Here's a simple example to demonstrate:

echo -e "A\nB\nC" > list1.txt
echo -e "1\n2\n3" > list2.txt
parallel echo ::: $(cat list1.txt) :::+ $(cat list2.txt)

The output will be:

A 1
B 2
C 3

This behavior is different from using ::: multiple times. If you use ::: for both lists, parallel will execute commands for every possible combination:

command A 1
command A 2
command A 3
command B 1
... and so on

In summary, :::+ ensures that each item from the first list is combined with the corresponding item from the second list in the order they are provided.