In my understanding, awk array is something like python dict.So I write down the code bellow to explore it:awk '{my_dict[$1] = $2} END { print my_dict}' zenAnd I got: awk: can't read value of my_dict; it's an array name.As the first column isn`t a number, how could I read the total content of the array or traverse it?
How to view all the content in an awk array?
awk
You can loop over the array's keys and extract the corresponding values:awk '{my_dict[$1] = $2} END { for (key in my_dict) { print my_dict[key] } }' zenTo get output similar to that you'd get with a Python dictionary, you can print the key as well:awk '{my_dict[$1] = $2} END { for (key in my_dict) { print key :  my_dict[key] } }' zenThis works regardless of the key type.