Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Feature request: two level sorting
- X-seq: zsh-users 21676
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: Zsh Users <zsh-users@xxxxxxx>
- Subject: Re: Feature request: two level sorting
- Date: Thu, 16 Jun 2016 08:43:00 -0700
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=brasslantern-com.20150623.gappssmtp.com; s=20150623; h=from:message-id:date:in-reply-to:comments:references:to:subject :mime-version; bh=pCiRRtolhGHH1GHFzdrqtToDAMQb1vTky9AwVVIwFlo=; b=UQkU3odI8kDqmlw6yJQTOQgmRqwuZd7Wpzurq2REH3Y/y+M4Py18Fofka+sE0JirGq rNK5sU3jues1O9lFvFlbcc+HP2ldwO3SkhzsxeK/OgVW9e3hSEzo580BB24Cg3xp2U9Z ggIbbbVXJ4IpXxYc/fJCptWtOF4+I/ikqbSkvczWqBq6Yulic+E7e42sXKKOFplQhS8c qDJMBYOETcpEIOxjYF7nSignXixSAff39YDBcUQZvkqPKt4UauS0g/+ww8MOX4NIBFbp QWnr88DuVEsNWaUXjNmLlfUz3pA35fEfn7bPdwwPjRUEHQRYz7mMLZQeUYJ+z+P/TWUC pl+Q==
- 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 Jun 16, 1:02am, Mikael Magnusson 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
Heh, you don't even need / to be readable, any single readable file
will do:
torch% echo /dev/null(e:'reply=($myarray)':oe:'REPLY=${REPLY#*-}':)
aac-A aaa-A aab-B aad-C
Rather hard to embed that in a parameter expansion context without
using a process substitution, though. And I don't think it covers
the secondary sort: note that in Sebastian's original example he
wants (aaa-A aac-A) but the above output has them the other way
(the sort isn't guaranteed to be stable).
Messages sorted by:
Reverse Date,
Date,
Thread,
Author