• Ogłoszenie:

Why does unix sort alphanumeric data unexpectedly?

Dyskusje i problemy z Unix'ami

Why does unix sort alphanumeric data unexpectedly?

Postprzez MitchelBraybh 21 Cze 2023, 12:38

reklama
I'm currently enrolled in an online Unix course and have comprehended most of the material. However, I'm having difficulty understanding how Unix determines the order in which it sorts items using the default sort function.

As an example, I created a .txt file with the following content:

31 charlie 12 alpha 8 beta

When I execute the $sort command, the output is: 12 alpha 31 charlie 8 beta

Based on the fact that it's an alphanumeric sequence, I would expect "beta" to come before "charlie" since "b" precedes "c," but that's not the case.

Could someone please provide an explanation for this? I apologize for the novice question, but I'm determined to gain a thorough understanding of all the concepts covered before moving forward. Thank you in advance for your assistance.
MitchelBraybh
~user
 
Posty: 15
Dołączenie: 25 Sty 2023, 10:54



Powróć do System Linux / Unix

Kto jest na forum

Użytkownicy przeglądający to forum: bastyytri66 oraz 2 gości