Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: nesting issue
On Sun, May 5, 2024, at 9:52 AM, Ray Andrews wrote:
> 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'.
Those are not the same.
% : >foo{-2,10,1,+3}
% print -l -- foo*(n)
foo+3
foo-2
foo1
foo10
% printf %s\\n foo* | gsort -V
foo1
foo10
foo+3
foo-2
> This is what I dare say everybody wants:
Nonsense. There is no universally desired sort. It depends entirely
on what the application needs.
> One quibble, I see (cut down):
>
> aaa,3a,pard
> aaa,3,pard
I don't see this behavior.
% locale
LANG="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_CTYPE="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_ALL=
% : >aaa,3{,a},pard
% in=(aaa,*(n))
% print -l $in
aaa,3,pard
aaa,3a,pard
--
vq
Messages sorted by:
Reverse Date,
Date,
Thread,
Author