I would like to sort an array with POSIX Awk, however I have discovered that:
- asort()
- asorti()
- PROCINFO["sorted_in"]
are all GNU extensions. Can this be done with without GNU Awk?
I would like to sort an array with POSIX Awk, however I have discovered that:
asort()asorti()PROCINFO["sorted_in"]are all GNU extensions. Can this be done with without GNU Awk?
Here is an example:
function arr_sort(ary,   x, y, z) {
  for (x in arr) {
    y = arr[x]
    z = x - 1
    while (z && arr[z] > y) {
      arr[z + 1] = arr[z]
      z--
    }
    arr[z + 1] = y
  }
}