When using redirection inside the command for parallel
, you have to use {}
to put the input at the right place, as parameter for sed
:
echo "$z" | parallel 'sed "s/\(^3.*3\)/\13/" {} > {//}/result.txt'
Additionally, if {//}
(or any other replacement string) is used, parallel
does not append the input at the end of the command automatically. (In this case that would be wrong anyways, as it would be after the redirection. )
Essentially, the code in the question runs
sed "s/(^3.*3\)/\13/" > ./result.txt
but it needs to be
sed "s/(^3.*3\)/\13/" ./input.txt > ./result.txt