Sorting indices numerically

12 views
Skip to first unread message

solitary....@gmail.com

unread,
Oct 25, 2021, 12:26:38 PM10/25/21
to
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

Ed Morton

unread,
Oct 25, 2021, 12:41:05 PM10/25/21
to
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.

solitary....@gmail.com

unread,
Oct 25, 2021, 5:03:29 PM10/25/21
to
Thanks, Ed. Worked like a charm.


Steve
Reply all
Reply to author
Forward
0 new messages