Suppose I am running gnu parallel on an array of items received from standard in, and split according to some criteria:
cat content | parallel -j 4 my_command
How do I access the job number such that I can pass into command, as an argument, the job number/id of the parallel execution (so that each parallel execution block has a unique number):
cat content | parallel -j 4 my_command -n ???
(Is this even possible? Reviewing the man pages at the moment)
You are looking for the replacement string {#}
cat content | parallel -j 4 my_command -n {#}
It is also mentioned on the cheat sheet: https://www.gnu.org/software/parallel/parallel_cheat.pdf
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With