Skip to main content
Removed link to a comment that has been deleted.
Source Link
B Layer
  • 5.3k
  • 1
  • 21
  • 35

Omitting your other parallel flags just to stay focused...

parallel --link pf ::: A B ::: C D

This will run your function first with a=A, b=C followed by a=B, b=D or

a=A b=C
a=B b=D

Without --link you get full combination like this:

a=A b=C
a=A b=D
a=B b=C
a=B b=D

Update: As Ole Tange metioned in a comment [since deleted Ole Tange metioned in a comment- Ed.] there is another way to do this,: use the :::+ operator. ThereHowever, there is an important difference between the two alternatives IF the number of arguments is not the same in each param positionif the number of arguments is not the same in each param position. An example will illustrate:.

parallel --link pf ::: A B ::: C D E output:

a=A b=C
a=B b=D
a=A b=E

parallel pf ::: A B :::+ C D E output:

a=A b=C
a=B b=D

So --link will "wrap" sosuch that all arguments are consumed while :::+ will ignore the extra argument. Personally(In the general case I don't like when things are silently ignored so that's why my preference isprefer --link since the alternative is in some sense silently ignoring input. YMMV.)

Omitting your other parallel flags just to stay focused...

parallel --link pf ::: A B ::: C D

This will run your function first with a=A, b=C followed by a=B, b=D or

a=A b=C
a=B b=D

Without --link you get full combination like this:

a=A b=C
a=A b=D
a=B b=C
a=B b=D

Update: As Ole Tange metioned in a comment there is another way to do this, the :::+ operator. There is an important difference between the two alternatives IF the number of arguments is not the same in each param position. An example will illustrate:

parallel --link pf ::: A B ::: C D E output:

a=A b=C
a=B b=D
a=A b=E

parallel pf ::: A B :::+ C D E output:

a=A b=C
a=B b=D

--link will "wrap" so all arguments are consumed while :::+ will ignore the extra argument. Personally I don't like when things are silently ignored so that's why my preference is --link. YMMV.

Omitting your other parallel flags just to stay focused...

parallel --link pf ::: A B ::: C D

This will run your function first with a=A, b=C followed by a=B, b=D or

a=A b=C
a=B b=D

Without --link you get full combination like this:

a=A b=C
a=A b=D
a=B b=C
a=B b=D

Update: As Ole Tange metioned in a comment [since deleted - Ed.] there is another way to do this: use the :::+ operator. However, there is an important difference between the two alternatives if the number of arguments is not the same in each param position. An example will illustrate.

parallel --link pf ::: A B ::: C D E output:

a=A b=C
a=B b=D
a=A b=E

parallel pf ::: A B :::+ C D E output:

a=A b=C
a=B b=D

So --link will "wrap" such that all arguments are consumed while :::+ will ignore the extra argument. (In the general case I prefer --link since the alternative is in some sense silently ignoring input. YMMV.)

Fixed comment link.
Source Link
B Layer
  • 5.3k
  • 1
  • 21
  • 35

Omitting your other parallel flags just to stay focused...

parallel --link pf ::: A B ::: C D

This will run your function first with a=A, b=C followed by a=B, b=D or

a=A b=C
a=B b=D

Without --link you get full combination like this:

a=A b=C
a=A b=D
a=B b=C
a=B b=D

Update: As Ole tange metioned in a commentOle Tange metioned in a comment there is another way to do this, the :::+ operator. There is an important difference between the two alternatives IF the number of arguments is not the same in each param position. An example will illustrate:

parallel --link pf ::: A B ::: C D E output:

a=A b=C
a=B b=D
a=A b=E

parallel pf ::: A B :::+ C D E output:

a=A b=C
a=B b=D

--link will "wrap" so all arguments are consumed while :::+ will ignore the extra argument. Personally I don't like when things are silently ignored so that's why my preference is --link. YMMV.

Omitting your other parallel flags just to stay focused...

parallel --link pf ::: A B ::: C D

This will run your function first with a=A, b=C followed by a=B, b=D or

a=A b=C
a=B b=D

Without --link you get full combination like this:

a=A b=C
a=A b=D
a=B b=C
a=B b=D

Update: As Ole tange metioned in a comment there is another way to do this, the :::+ operator. There is an important difference between the two alternatives IF the number of arguments is not the same in each param position. An example will illustrate:

parallel --link pf ::: A B ::: C D E output:

a=A b=C
a=B b=D
a=A b=E

parallel pf ::: A B :::+ C D E output:

a=A b=C
a=B b=D

--link will "wrap" so all arguments are consumed while :::+ will ignore the extra argument.

Omitting your other parallel flags just to stay focused...

parallel --link pf ::: A B ::: C D

This will run your function first with a=A, b=C followed by a=B, b=D or

a=A b=C
a=B b=D

Without --link you get full combination like this:

a=A b=C
a=A b=D
a=B b=C
a=B b=D

Update: As Ole Tange metioned in a comment there is another way to do this, the :::+ operator. There is an important difference between the two alternatives IF the number of arguments is not the same in each param position. An example will illustrate:

parallel --link pf ::: A B ::: C D E output:

a=A b=C
a=B b=D
a=A b=E

parallel pf ::: A B :::+ C D E output:

a=A b=C
a=B b=D

--link will "wrap" so all arguments are consumed while :::+ will ignore the extra argument. Personally I don't like when things are silently ignored so that's why my preference is --link. YMMV.

added 573 characters in body
Source Link
B Layer
  • 5.3k
  • 1
  • 21
  • 35

Omitting your other parallel flags: just to stay focused...

parallel --link pf ::: A B ::: C D

This will run your function first with a=A, b=C followed by a=B, b=D or

a=A b=C
a=B b=D

Without --link you get full combination like this:

a=A b=C
a=A b=D
a=B b=C
a=B b=D
 

I believe you wantUpdate: As Ole tange metioned in a comment there is another way to avoiddo this, the :::+ operator. There is an important difference between the two alternatives IF the number of arguments is not the same in each param position. An example will illustrate:

parallel --link pf ::: A B ::: C D E output:

a=A b=C
a=B b=D
a=A b=E

parallel pf ::: A B :::+ C D E output:

a=A b=C
a=B b=D

--link will "wrap" so all arguments are consumed while :::+ will ignore the extra argument.

Omitting your other parallel flags:

parallel --link pf ::: A B ::: C D

This will run your function first with a=A, b=C followed by a=B, b=D or

a=A b=C
a=B b=D

Without --link you get full combination like this:

a=A b=C
a=A b=D
a=B b=C
a=B b=D

I believe you want to avoid this.

Omitting your other parallel flags just to stay focused...

parallel --link pf ::: A B ::: C D

This will run your function first with a=A, b=C followed by a=B, b=D or

a=A b=C
a=B b=D

Without --link you get full combination like this:

a=A b=C
a=A b=D
a=B b=C
a=B b=D
 

Update: As Ole tange metioned in a comment there is another way to do this, the :::+ operator. There is an important difference between the two alternatives IF the number of arguments is not the same in each param position. An example will illustrate:

parallel --link pf ::: A B ::: C D E output:

a=A b=C
a=B b=D
a=A b=E

parallel pf ::: A B :::+ C D E output:

a=A b=C
a=B b=D

--link will "wrap" so all arguments are consumed while :::+ will ignore the extra argument.

Use correct term: combination.
Source Link
B Layer
  • 5.3k
  • 1
  • 21
  • 35
Loading
Improved layout and description.
Source Link
B Layer
  • 5.3k
  • 1
  • 21
  • 35
Loading
Source Link
B Layer
  • 5.3k
  • 1
  • 21
  • 35
Loading