Se você quiser apenas usar matrizes simples bash
-
#read in the data from 2 files
unset arr1; declare -A arr1;
while read -r -u3 line; do \
i=${line%_*}; \
i=${i#*_}; \
arr1[$i]+=" $line"; \
done 3< <(cat f1 f2); \
exec 3<&-
#output array by iterating throug the keys
for k in "${!arr1[@]}"; do \
echo ${arr1[$k]}; \
done | sort
Saída -
r11_abc_gkhsa 1.0 1.5 1.9 ab1_abc_gkhsa 1.6 1.4 1.5
r11_acd_gkhsa 1.3 1.6 1.5 sd1_acd_gkhsa 1.2 1.3 1.5
r11_bcd_gkhsa 1.0 1.5 1.7 sd1_bcd_gkhsa 1.8 1.5 1.9
r11_xyz_gkhsa 1.0 1.5 1.9 sfs_xyz_gkhsa 1.4 1.6 1.4
sfs_ryb_gkhsa 1.5 1.2 1.7