zsh-users
 help / color / mirror / code / Atom feed
From: Ray Andrews <rayandrews@eastlink.ca>
To: zsh-users@zsh.org
Subject: Re: nesting issue
Date: Sun, 5 May 2024 06:52:59 -0700	[thread overview]
Message-ID: <eabbd3e4-ef9e-4ff2-8510-a6427a11f08a@eastlink.ca> (raw)
In-Reply-To: <CAN=4vMqF=z7rs75BMQy+baKXgHO0EtiEq6eN5jQ1b-LGXTKvUg@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 1278 bytes --]



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.)


[-- Attachment #2: Type: text/html, Size: 2237 bytes --]

  reply	other threads:[~2024-05-05 13:53 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-04 19:36 Ray Andrews
2024-05-05  3:20 ` Bart Schaefer
2024-05-05  5:39   ` Lawrence Velázquez
2024-05-05  5:40   ` Roman Perepelitsa
2024-05-05 13:52     ` Ray Andrews [this message]
2024-05-05 20:14       ` Lawrence Velázquez
2024-05-05 22:18         ` Ray Andrews
2024-05-05 23:26           ` Lawrence Velázquez
2024-05-06  1:51             ` Ray Andrews
2024-05-06  3:22               ` Bart Schaefer
2024-05-06 13:01                 ` Ray Andrews
2024-05-06  3:43               ` Lawrence Velázquez
2024-05-06 13:09                 ` Ray Andrews
2024-05-05 13:13   ` Ray Andrews
2024-05-05 19:44     ` Lawrence Velázquez
2024-05-05 20:14       ` Ray Andrews
2024-05-05 20:45         ` Lawrence Velázquez
2024-05-05 22:22           ` Ray Andrews

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=eabbd3e4-ef9e-4ff2-8510-a6427a11f08a@eastlink.ca \
    --to=rayandrews@eastlink.ca \
    --cc=zsh-users@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).