Groups | Search | Server Info | Login | Register


Groups > comp.lang.awk > #9904

Sorting with GNU Awk

From Janis Papanagnou <janis_papanagnou+ng@hotmail.com>
Newsgroups comp.lang.awk
Subject Sorting with GNU Awk
Date 2025-02-11 03:13 +0100
Organization A noiseless patient Spider
Message-ID <voebnd$1fnqi$1@dont-email.me> (permalink)

Show all headers | View raw


I have an application were I need sorting. My tests led me to
this variant that works as I expected (with GNU Awk 5.3.0)

  asort (arr, res, "@val_num_desc")

But I originally intended an _inplace_ sort and I thought that
using these commands would also work

  PROCINFO["sorted_in"] = "@val_num_desc"
  asort (arr)

but the sorting order is (contrary to my specifier) ascending.
So it seems PROCINFO is not considered by the asort() function?
(Or is that just inappropriately used?)

Another question; is there a simple way for a _unique sorting_
like Unix'es 'sort -u'? - By simple I mean some setting, not a
programmed function like using associative array indexes, etc.

Janis

Back to comp.lang.awk | Previous | NextNext in thread | Find similar


Thread

Sorting with GNU Awk Janis Papanagnou <janis_papanagnou+ng@hotmail.com> - 2025-02-11 03:13 +0100
  Re: Sorting with GNU Awk Kaz Kylheku <643-408-1753@kylheku.com> - 2025-02-11 02:47 +0000
    Re: Sorting with GNU Awk Janis Papanagnou <janis_papanagnou+ng@hotmail.com> - 2025-02-11 05:09 +0100

csiph-web