coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Is there a way to always put NA before (or after) numerical values i


From: Pádraig Brady
Subject: Re: Is there a way to always put NA before (or after) numerical values in sort?
Date: Sat, 9 Dec 2017 15:09:19 -0800
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0

On 08/12/17 05:57, Peng Yu wrote:
> printf '%s\n' .1 1 NA | sort -k 1,1rg

Well conversion errors are guaranteed to be put at the start.
Is that sufficient?  Currently there is no way to change that.

  $ printf '%s\n' -1 0 1 NA2 NA1 | sort -k 1,1g --debug -s
  sort: using ‘en_IE.UTF-8’ sorting rules
  NA2
  ^ no match for key
  NA1
  ^ no match for key
  -1
  __
  0
  _
  1
  _

Often DSU (Decorate Sort Undecorate) is useful,
and one could convert NA to/from inf or nan.

cheers,
Pádraig



reply via email to

[Prev in Thread] Current Thread [Next in Thread]