Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: How to impose a numeric sort on negative numbers?
On Wed, 1 Jul 2020 at 20:48, Lawrence Velázquez <vq@xxxxxxxxx> wrote:
> arguably cheating, and not robust since no one has any idea how
> clean your input is, but YOLO so whatever ;)
>
> % arr=(-1A -2b -3B 0 1A 2C 3B)
> % arr_sorted=(${(MOn)arr:#-*} ${(n)arr:#-*})
> % print -rl $arr_sorted
> -3B
> -2b
>
That's a good solution, thanks!
--
Sebastian Gniazdowski
IRC: https://kiwiirc.com/client/chat.freenode.net:+6697/#zinit
Blog: http://zdharma.org
Messages sorted by:
Reverse Date,
Date,
Thread,
Author