Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Feature request: two level sorting
- X-seq: zsh-users 21716
- From: Sebastian Gniazdowski <sgniazdowski@xxxxxxxxx>
- To: Mikael Magnusson <mikachu@xxxxxxxxx>
- Subject: Re: Feature request: two level sorting
- Date: Fri, 1 Jul 2016 09:16:30 +0200
- Cc: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>, Zsh Users <zsh-users@xxxxxxx>
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=97z77WY0j8B28nIwOELMZxXWHwP0hgw8BFF++dCpQo8=; b=WDu+xr8+xjS+BKYcjp74JFD8gT1m5palLKaxbFg1l711B+4NosXdB3vr8bAHZPEaJf hbMQ2xevV+Al8CTow0cQpws0ebqCY+tJtqbPMQTaznIWxGmuj8eARZQoNamWf+yA8qu0 kM8EV9cxZAs/smpzwNIFLhQXq1qMpT/q6GxtdkmIolvfZujOhOzbntlVdZlZVyuVlBMO 093vWQVM0ytR9R2i+3RBoXXWY+SR9yWc/Kn/KXo3GRbGS2yagUUatSgp5fE5s37rRWKg QNQci+joaHXmyIxFBXzPK+XGjpDdIzv+yCMU4ZxL7wkO0EFMFQGMhGDA88B/9uiKKXE6 y+TA==
- In-reply-to: <CAHYJk3SOca2W212_KZLskjD0iUOy7gdxUx81H07B07HGHNN=CQ@mail.gmail.com>
- List-help: <mailto:zsh-users-help@zsh.org>
- List-id: Zsh Users List <zsh-users.zsh.org>
- List-post: <mailto:zsh-users@zsh.org>
- Mailing-list: contact zsh-users-help@xxxxxxx; run by ezmlm
- References: <CAKc7PVAsLwNVP0vjTvBebP5u+Ahe03yXaWxkvytOx4EPkN4V9Q@mail.gmail.com> <160615101239.ZM21280@torch.brasslantern.com> <CAHYJk3Qaq6zUDuCNKMS5vbznA3YWnKT6q9d5mcGn7CCFEQ-Hrg@mail.gmail.com> <160615153817.ZM22021@torch.brasslantern.com> <CAHYJk3SOca2W212_KZLskjD0iUOy7gdxUx81H07B07HGHNN=CQ@mail.gmail.com>
On 16 June 2016 at 01:02, Mikael Magnusson <mikachu@xxxxxxxxx> wrote:
> Well, this old trick always works if you don't mind depending on /
> being readable, but that's probably a safe assumption usually.
>
> % myarray=("aaa-A" "aab-B" "aac-A" "aad-C")
> % echo /(e:'reply=($myarray)':oe:'REPLY=${REPLY#*-}':)
> aac-A aaa-A aab-B aad-C
Could this be used to alter numeric sort a little? The point is to
have numbers be ordered *after* letters, not *before* letters. Example
# a=( "aaa" "aeg" "aa1" "ae2" )
# echo ${(on)a[@]}
aa1 aaa ae2 aeg
This places "1" before "a" (1 < a) and "2" before "g" (2 < g). With
this reversed, the result would be:
aaa aa1 aeg ae2
So now a < 1 and g < 2.
Best regards,
Sebastian Gniazdowski
Messages sorted by:
Reverse Date,
Date,
Thread,
Author