Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: nesting issue
- X-seq: zsh-users 29894
- From: Ray Andrews <rayandrews@xxxxxxxxxxx>
- To: zsh-users@xxxxxxx
- Subject: Re: nesting issue
- Date: Sun, 5 May 2024 06:52:59 -0700
- Archived-at: <https://zsh.org/users/29894>
- In-reply-to: <CAN=4vMqF=z7rs75BMQy+baKXgHO0EtiEq6eN5jQ1b-LGXTKvUg@mail.gmail.com>
- List-id: <zsh-users.zsh.org>
- References: <b26aef45-320d-4bf5-80e9-7ce0000afa3d@eastlink.ca> <CAH+w=7aqkafqXHReUU2iOhAoOFbwBbdoFyuBWTOTnRM6xiEM3g@mail.gmail.com> <CAN=4vMqF=z7rs75BMQy+baKXgHO0EtiEq6eN5jQ1b-LGXTKvUg@mail.gmail.com>
On 2024-05-04 22:40, Roman Perepelitsa
wrote:
local sorted=( $1,*(nN) )
Beautiful. I get a 'version sort' in one go which is just what I
want. Subsequent to my code snip I run the thing through ' | sort
-V ' to get the version sort, but little 'n' is smart enough to
handle that in one line. Dunno, it always seemed to me that
'numeric sort' is intuitively what the sort command calls 'version
sort'.
This is what I dare say everybody wants:
8 /aWorking/Zsh/Source/Wk/Boneyard 1 % local in=(aaa,*(nN)); print
-l $in
aaa,1
aaa,2
aaa,2,howdy
aaa,3a,pard
aaa,3,pard
aaa,4,2a howdy
aaa,5c,pard
aaa,5,pard
aaa,6
aaa,6a,howdy
aaa,7,aaa,7
aaa,8
aaa,9
aaa,9a
aaa,10
aaa,11
aaa,11,pard
aaa,12,12a
aaa,12,some_somme
(
One quibble, I see (cut down):
aaa,3a,pard
aaa,3,pard
aaa,6
aaa,6a,howdy
... I'd expect
aaa,3,pard
aaa,3a,pard
... however ' sort -V' does exactly the same as 'n' so I'm not
whining.
)
... and this is not:
8 /aWorking/Zsh/Source/Wk/Boneyard 1 % local in=(aaa,*(nN)); print
-l $in | sort -n
aaa,1
aaa,10
aaa,11
aaa,11,pard
aaa,12,12a
aaa,12,some_somme
aaa,2
aaa,2,howdy
aaa,3a,pard
aaa,3,pard
aaa,4,2a howdy
aaa,5c,pard
aaa,5,pard
aaa,6
aaa,6a,howdy
aaa,7,aaa,7
aaa,8
aaa,9
aaa,9a
(sorry about the garbage filenames, they're stress testers.)
Messages sorted by:
Reverse Date,
Date,
Thread,
Author