I'm trying to somehow use
xargs so a program whose outputs are the lines
<ARG1> <ARG2> ... <ARGN>
will cause the execution of the following command:
command <GLOBAL_PREFIX_1> \ <GLOBAL_PREFIX_2> \ ... \ <PREFIX1> <PREFIX2> ... ARG1 <SUFFIX1> <SUFFIX2> ... \ <PREFIX1> <PREFIX2> ... ARG2 <SUFFIX1> <SUFFIX2> ... \ ... \ <PREFIX1> <PREFIX2> ... ARGN <SUFFIX1> <SUFFIX2> ... \ <GLOBAL_SUFFIX_1> \ <GLOBAL_SUFFIX_2> \ ...
where the prefixes and suffixes are known beforehand, but arbitrary.
Some (probably) obvious notes that I feel like I have to explicitly state anyway:
The parameters are not "nice". They lack newlines but might contain spaces,
I would like to avoid converting them to a single giant string and back if at all possible.
Yes, I meant what I wrote. I really just only want 1 command to run: not 0, not 2, not 3, not
More generally: I don't want to spawn a new process for each argument.
Simpler tools are preferred, assuming correctness is given... so
xargsis preferred over
sed, which is preferred over
I'm trying to use standard *nix shell tools here.
Obviously I can write a Python script, but that's not the point...