• Re: Sorting indices numerically

    From Ed Morton@21:1/5 to solitary....@gmail.com on Mon Oct 25 11:41:04 2021
    On 10/25/2021 11:26 AM, solitary....@gmail.com wrote:
    I have a multi-dimensional array where 1 of the levels has integers and I would like to sort this level numerically. I thought one could do this placing a certain value in the 3rd subscript of asorti. Is that true? If so, what is the value?


    Thanks, Steve


    Yes, see https://www.gnu.org/software/gawk/manual/gawk.html#Controlling-Scanning.
    See also
    https://www.gnu.org/software/gawk/manual/gawk.html#Array-Sorting as you
    may not need asorti() depending on what you're going to do with the result.

    Note that asorti() is a GNU awk extension.

    Ed.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From solitary.wanderer52@gmail.com@21:1/5 to All on Mon Oct 25 09:26:37 2021
    I have a multi-dimensional array where 1 of the levels has integers and I would like to sort this level numerically. I thought one could do this placing a certain value in the 3rd subscript of asorti. Is that true? If so, what is the value?


    Thanks, Steve

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From solitary.wanderer52@gmail.com@21:1/5 to Ed Morton on Mon Oct 25 14:03:28 2021
    On Monday, October 25, 2021 at 11:41:05 AM UTC-5, Ed Morton wrote:
    On 10/25/2021 11:26 AM, solitary....@gmail.com wrote:
    I have a multi-dimensional array where 1 of the levels has integers and I would like to sort this level numerically. I thought one could do this placing a certain value in the 3rd subscript of asorti. Is that true? If so, what is the value?


    Thanks, Steve

    Yes, see https://www.gnu.org/software/gawk/manual/gawk.html#Controlling-Scanning.
    See also
    https://www.gnu.org/software/gawk/manual/gawk.html#Array-Sorting as you
    may not need asorti() depending on what you're going to do with the result.

    Note that asorti() is a GNU awk extension.

    Ed.

    Thanks, Ed. Worked like a charm.


    Steve

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)