
Question:
<blockquote>
This question is very close to <a href="https://stackoverflow.com/questions/22187834/gnu-parallel-output-each-job-to-a-different-file" rel="nofollow">this other</a>, but that answer is not valid for me, I think due to my shell script does not work with pipes.
</blockquote>This is my multi-job command :
parallel "./ClientesActivos-AP-N.sh -t 15" ::: $(seq 0 2)
I would like output to something like:
file0.out
file1.out
file2.out
I don't know where should I put the <strong>redirector</strong> >
.
I have tested with no luck:
parallel ./ClientesActivos-AP-N.sh -t 15 ">" file{}.out ::: $(seq 0 1)
parallel ./ClientesActivos-AP-N.sh -t 15 ::: $(seq 0 1) ">" file{}.out
My <strong>script</strong> works in this way:
./ClientesActivos-AP-N.sh -t 15 0
./ClientesActivos-AP-N.sh -t 15 1
./ClientesActivos-AP-N.sh -t 15 2
So output would go (for the above manual unparallelized example) to file0.out
, file1.out
and file2.out
.
What is the correct way to redirect <strong>each job</strong> to a different file?
Further unsuccessful tests:
parallel --files file{}.out "./ClientesActivos-AP-N.sh -t 15" ::: $(seq 0 2)
Answer1:I find that the --dry-run
option is a great way to debug <strong>GNU Parallel</strong> commands. Basically, it tells you what it would do without actually doing anything - it also saves me having to write a dummy <em>"ClientesActivos"</em> script and we all know how good my Spanish isn't ;-)
So, to your immediate question, if you try this, I think what it shows is what you want to do:
$ parallel --dry-run ./ClientesActivos-AP-N.sh -t 15 {} ">" file{}.out ::: {0..1}
./ClientesActivos-AP-N.sh -t 15 0 > file0.out
./ClientesActivos-AP-N.sh -t 15 1 > file1.out