awk sort multidimensional array [duplicate]
问题 This question already has an answer here : Appending an element to associative array awk (1 answer) Closed 4 years ago . GNU awk supports multidimensional arrays: q[1][1] = "dog" q[1][2] = 999 q[2][1] = "mouse" q[2][2] = 777 q[3][1] = "bird" q[3][2] = 888 I would like to sort the "second column" of q such that I am left with: q[1][1] = "mouse" q[1][2] = 777 q[2][1] = "bird" q[2][2] = 888 q[3][1] = "dog" q[3][2] = 999 as you can see the "first column" values moved to keep with the second. I