'Avoid backslashing of space character in GNU parallel input
eNeed you help over here!
What I want
Pass a space-containing argument to a command using GNU parallel so it doesn't backslash it.
Example:
parallel --dry-run COMMAND {} ::: opt1 "opt2 arg" opt3
Expected result:
COMMAND opt1
COMMAND opt2 arg
COMMAND opt3
Obtained result:
COMMAND opt1
COMMAND opt2\ arg
COMMAND opt3
Space character is backslashed making my command to fail
Why I want it
I want it because my command uses options which, only in some cases, need a explicit argument. I want to run it several times with a different option each and over different sets of data.
And because it has to be possible and I want to know how!!
What I have tried
All these variants and all (or at least many) permutations among them (even if some may make not sense):
parallel COMMAND {} ::: opt1 'opt2 arg' opt3
parallel -q COMMAND {} ::: opt1 "opt2 arg" opt3
parallel eval COMMAND {} ::: opt1 "opt2 arg" opt3
parallel COMMAND {} :::: file # one option per line trying both, quoted and unquoted
cat file | parallel COMMAND {}
A="opt2 arg"
parallel COMMAND {} ::: opt1 $A opt3
Nothing works. I always get the backslash escaping the space. Read the manual but can't find the solution to my problem. I'm probably missing or not understanding something.
Any suggestion??
Thank you very much.
Solution 1:[1]
Example: You want to run seq 5 10. This does not work:
parallel seq ::: "5 10"
This works:
parallel eval seq ::: "5 10"
Version >=20190722:
parallel seq {=uq=} ::: "5 10"
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Ole Tange |
