Isso usa esponja do pacote moreutils do Debian. Nenhuma ismo bash .
Faça o backup dos quatro arquivos de entrada da maneira que quiser (pois isso os alterará), então:
# enumerate headers of each file, then sort each file, in place
for f in file* ; do
sed '1s/.*/&'"$f"'/;s/file//' $f | sort | sponge $f
done
# join sorted files, output to 'fileN'
for f in 34 N2 N1 ; do join --header file[$f] | sponge fileN ; done
# reformat header, in place
sed -i '1s/d/d /' fileN
cat fileN
Saída:
gene_id FPKM1 FPKM2 FPKM3 FPKM4
TRINITY_DN42427_c0_g1 12.83 14.03 24.03 34.03
TRINITY_DN48728_c0_g1 6.22 6.05 7.05 7.05
TRINITY_DN48996_c1_g1 28.21 16.47 26.47 36.5
TRINITY_DN50706_c0_g2 6604.75 5176.34 4176.34 9176.34
TRINITY_DN51449_c1_g1 8.19 7.58 6.58 7.58
TRINITY_DN56960_c4_g1 36.91 80.91 90.91 120.91