[root@rocky ~]# cat c
a b 1
a c 4
a r 6
a t 2
b a 89
b c 76
a d 45
b z 9
[root@rocky ~]# awk '{a[$1][$2]=$3}END{PROCINFO["sorted_in"]="@val_num_asc";for(i in a){for(x in a[i])print i,x,a[i][x]}}' c
a b 1
a t 2
a c 4
a r 6
a d 45
b z 9
b c 76
b a 89
[root@rocky ~]# awk '{a[$2]=$3}END{PROCINFO["sorted_in"]="@val_num_asc";for(i in a)print i,a[i]}' c
b 1
t 2
r 6
z 9
d 45
c 76
a 89
[root@rocky ~]# awk '{a[$2]=$3}END{PROCINFO["sorted_in"]="@val_num_desc";for(i in a)print i,a[i]}' c
a 89
c 76
d 45
z 9
r 6
t 2
b 1
[root@rocky ~]# awk '{a[$1][$2]=$3}END{PROCINFO["sorted_in"]="@val_num_desc";for(i in a){for(x in a[i])print i,x,a[i][x]}}' c
a d 45
a r 6
a c 4
a t 2
a b 1
b a 89
b c 76
b z 9
[root@rocky ~]# awk --version
GNU Awk 4.2.1, API: 2.0 (GNU MPFR 3.1.6-p2, GNU MP 6.1.2)
There is a problem with the sorting of multidimensional arrays using PROCINFO["sorted_in"]="@val_num_asc" or PROCINFO["sorted_in"]="@val_num_desc", and there is no real sorting. There is no problem with one-dimensional arrays. What is the problem? Is it because it does not support multidimensional arrays?