Timeline for How to sort an associative array and retain the keys?
Current License: CC BY-SA 3.0
9 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Sep 30, 2024 at 5:08 | vote | accept | dibs | ||
| Jun 2, 2021 at 7:39 | comment | added | von spotz | @Gilles'SO-stopbeingevil' Thank you very much! | |
| Jun 2, 2021 at 7:04 | comment | added | Gilles 'SO- stop being evil' | @vonspotz -k sets the sort key, i.e. what part of each line to use to sort. 2 means to start at the second field. n means to use numerical order rather than lexicographic order (so 9 sorts before 10). | |
| Jun 2, 2021 at 1:39 | comment | added | von spotz | @Gilles'SO-stopbeingevil' Hello, could you kindly explain what the -k 2n option means? Best wishes, von Spotz | |
| Apr 27, 2018 at 15:17 | comment | added | pdolinaj | How would I modify this function to display for example only the TOP 2 file names, without the count? | |
| Mar 9, 2015 at 12:08 | comment | added | Gilles 'SO- stop being evil' | @dibs The for loop prints out lines like 00001.jpg:31. The sed command removes the part after the colon. I fixed an error that caused sorted_keys to be a single string containing all the names, instead of an array as intended. | |
| Mar 9, 2015 at 12:06 | history | edited | Gilles 'SO- stop being evil' | CC BY-SA 3.0 | fixed splitting of sorted_keys |
| Mar 9, 2015 at 11:51 | comment | added | dibs | I can't seem to get useful output with this so far. Could you humour me a bit. What does the sed stuff do? | |
| Mar 1, 2015 at 3:04 | history | answered | Gilles 'SO- stop being evil' | CC BY-SA 3.0 |