Using GNU parallel
: http://www.gnu.org/software/parallel/
I have a program that takes two arguments, e.g.
$ ./prog file1 file2
$ ./prog file2 file3
...
$ ./prog file23456 file23457
I'm using a script that generates the file name pairs, however this poses a problem because the result of the script is a single string - not a pair. like:
$ ./prog "file1 file2"
GNU parallel
seems to have a slew of tricks up its sleeves, I wonder if there's one for splitting text around separators:
$ generate_file_pairs | parallel ./prog ?
# where ? is text under consideration, like "file1 file2"
The easy work around is to split the args manually in prog, but I'd like to know if it's possible in GNU parallel
.
--colsep
will not remove the quotation marks, correct? Assuming the quotation marks surround the text, is there a way to trim them with parallel? For example, the following doesn't work:echo '"file1 file2"' | parallel --colsep ' ' ./prog {1} {2}
– Mustard