Gnu parallel: print each job to a different file

I am trying to process such text files awkusing the command parallelas a shell script, but could not get it to output each job to another file

If I try:

seq 10 | parallel awk \''{ if ( $5 > 0.4 ) print $2}'\' file{}.txt > file{}.out

It outputs to a file file{}.outinstead file1.out, file2.outetc.

The tutorial and man pages also suggest that I could use --files, but it just prints to stdout:

seq 10 | parallel awk \''{ if ( $5 > 0.4 ) print $2}'\' file{}.txt --files file{}.out
+4
source share
3 answers

Turns out I need to quote the redirect because it was handled outside parallel:

seq 10 | parallel awk \''{...}'\' file{}.txt ">" file{}.out
+4
source

- :

seq 10 | parallel " awk command > file{}.out "

, stdout. , tee. , , :

seq 10 | parallel " awk command | tee file{}.out "

0

Since I parallelized a script that supports without pipes , the solutions here are not valid for me, so I opened a new thread here , which solves the problem .

I hope this helps some others arriving here.

0
source

Source: https://habr.com/ru/post/1530160/


All Articles