[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: sort (-g) [offtopic]



On 19-02-2018, at 03h 23'27", Will Mengarini wrote about "Re: sort (-g) [offtopic]"
> * Ionel Mugurel Ciobica <I.M.Ciobica@upcmail.nl> [18-02/18=Su 16:55 +0100]:
> > [... How can something like
> > "III\nII\nI\nV\nIV\nVII\nVI\nVIII\nX\nIX"
> > [be sorted?  ...]
> 
> See `aptitude show msort`; it probably does what you need.


I can't see how that would work, I have read the manual and tried
almost all options. At best msort is still behaves as sort, placing IX
in between IV and V:

# cat roman
X
III
II
XI
IV
V
VI
VIII
VII
IX
XII
I

# cat roman | msort -q -w -l -y ROMAN
I
II
III
IV
IX
V
VI
VII
VIII
X
XI
XII

# cat roman | sort 
I
II
III
IV
IX
V
VI
VII
VIII
X
XI
XII

Did I miss anything?

Besides, how this msort will work in a pipe, when I have to sort by
date, things like 3-V-2017 and 17-IX-2016, I can't find the equivalent
of -k from sort into this msort.

What I need is something like sort -t- -k3,3n -k2,2m -k1,1n, where m
would ideally be the sorting of Roman numerals (or the months as Roman
numerals)...

Is there a way to add this extension to sort? Like it is right now:

| --sort=WORD
|               sort according to WORD: general-numeric -g,
| human-numeric -h, month -M, numeric -n, random -R, version -V

to add "roman numerals -m"
and to be able to specify a file with (all) roman numerals in their
proper order and ask sort to order using that 'dictionary'?

I am willing to try to add this to sort if anyone can point me in the
right direction...

Thank you.

Ionel


Reply to: