I have an array with filenames as keys and a numerical value as values.
MYARRAY[00001.jpg] = 31
MYARRAY[00002.jpg] = 200
MYARRAY[00003.jpg] = 98
I need to sort them so they are ordered by value. Which I am doing with
IFS=$'\n' SORTED=($(sort <<<"${MYARRAY[*]}"))
However I lose the keys and just have numerical ones now.
Desired output would be
00001.jpg:31
00003.jpg:98
00002.jpg:200
How can I retain the keys in such a sort?