Search code examples
gnu-parallel

Argument sweep in gnu parallel


I would like to run a parameter sweep of the command line argument of a command. The command is:

mycommand --fixed arg 5 --variable_arg 0

and I would like to vary variable_arg from 0-100. How can I do this in a single command using gnu parallel, which generating a separate file with all the individual commands?


Solution

  • Maybe something like this:

    parallel mycommand --fixed arg 5 --variable_arg {} ::: {0..100}
    

    If you want the result in myout.1 .. myout.100 you can use one of these:

    parallel --results myout.{} mycommand --fixed arg 5 --variable_arg {} ::: {0..100}
    parallel mycommand --fixed arg 5 --variable_arg {} '>' myout.{} ::: {0..100}