Nicolas
Nicolas

Reputation: 43

How to escape brace in gnu-parallel

I have a python script that I want to call using gnu-parallel this way:

parallel run_script.py --outfile=/path/to/somewhere/{}/{}.nc --shift={} ::: 1 2 3

How can I escape the first curly brace in [--outfile] to be used for python string formatting ?

Expected results:

parallel --dry-run run_script.py --outfile=/path/to/somewhere/{}/{}.nc --shift={} ::: 1 2 3
run_script.py --outfile=/path/to/somewhere/{}/{}.nc --shift=1
run_script.py --outfile=/path/to/somewhere/{}/{}.nc --shift=2
run_script.py --outfile=/path/to/somewhere/{}/{}.nc --shift=3

Upvotes: 4

Views: 1160

Answers (1)

Ole Tange
Ole Tange

Reputation: 33685

Use -I to change {} into something else:

parallel -I ,, --dry-run run_script.py --outfile=/path/to/somewhere/{}/{}.nc --shift=,, ::: 1 2 3

Upvotes: 3

Related Questions