function sedinho () { sed -i "s/^.*\]/>$1/g" $2;} export -f sedinho #### LIST1=($(cat Headers.txt)) LIST2=($(find /folder/with/fasta/files/ -maxdepth 0 -name "*CDS.fasta" | sort)) parallel --xapply sedinho {1} {2} ::: ${LIST1[@]} ::: ${LIST2[@]}