Re: sort without ignoring hyphens



"t" == tc314 <tc314@xxxxxxxxxxx> writes:

t> unsorted:
t> 22
t> 2-2
t> 2-3
t> 23
t> 21

t> linux sort produces:

with what options? i don't get that result

t> 21
t> 22
t> 2-2
t> 23
t> 2-3

i got this which makes more sense as - is earlier in ascii than the
digits. sort defaults to a text sort (same as perl).

2-2
2-3
21
22
23

t> desired sort:
t> 2-2
t> 2-3
t> 21
t> 22
t> 23
t> (in ASCII order: hyphen (ascii 45) then 0-9 (ascii 48-57) then A-Z
t> (ascii 65-90))

that is what linux/unix/gnu sort returns. and perl sort should return
the same thing if you keep it a text sort.

so show a runnable short example of your perl sort with input and output
that shows your results. what you claim above doesn't make sense.

uri

--
Uri Guttman ------ uri@xxxxxxxxxxxxxxx -------- http://www.sysarch.com --
----- Perl Code Review , Architecture, Development, Training, Support ------
--------- Free Perl Training --- http://perlhunter.com/college.html ---------
--------- Gourmet Hot Cocoa Mix ---- http://bestfriendscocoa.com ---------
.



Relevant Pages

  • Re: Need help sorting fixed length records
    ... l> are based on fields and field delimiters which I don't have as the ... also unix sort can sort by column positions. ... should be faster than any perl sort. ...
    (comp.lang.perl.misc)
  • Re: Sort collating sequence
    ... 2/ It uses two sorting modes - the sort mode of the user or another which I ... > The out of sequence use of the "_" character is probably a Microsoftism -> this lets you force a directory or filename to be sorted before> similar named ones in directory/folder views. ... NO, I don't think it's that, because the underscore is also> collated before digits, which is way out whack with ASCII. ...
    (microsoft.public.windowsxp.help_and_support)
  • Re: Sort collating sequence
    ... 2/ It uses two sorting modes - the sort mode of the user or another which I don't know what it does. ... NO, I don't think it's that, because the underscore is also> collated before digits, which is way out whack with ASCII. ...
    (microsoft.public.windowsxp.help_and_support)
  • Re: Sort collating sequence
    ... It is sorting correctly. ... It is not ASCII. ... The system's default behavior is to sort punctuation first, followed by numbers and letters. ...
    (microsoft.public.windowsxp.help_and_support)
  • Re: Sort ignores apostrophe
    ... If the database is really large, this would be a reason to move to MSDE. ... > Could you use the Replacefunction to replace the single quote with a ... >> is specifically excluded from a sort in SQL. ... >> double quote = ASCII 34 ...
    (microsoft.public.access.queries)