2

I would like to use sort to sort by ASCII value, or at least by not disregarding punctuation, i.e:

sort <<DATA
a.01
a.04
a2
a.3
a.2
DATA

Should produce

a.01
a.04
a.2
a.3
a2

Especially these properties are important:

  • Dots are not ignored, so a.2 < a.3 < a2
  • Numbers are not treated specially, so a.04 < a.3

How do I achieve this?

Stephen Kitt
  • 434,908
keppla
  • 21
  • 2
    In case it's not clear, LC_COLLATE=C sort … should do what you want. – Kamil Maciorowski Sep 28 '21 at 17:58
  • Sorry for my previous comment stating otherwise, and for disregarding the prompt for the existing solution, it totally solves the problem. – keppla Sep 28 '21 at 19:00
  • blah, even though it has exactly the right answer, that linked question was one of the worst questions I've seen in a while... – ilkkachu Sep 28 '21 at 20:03

0 Answers0