Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

8
  • I get confused when mixed character strings are introduced. Consider for example the case of a3 b2 c1. I tend to think this should be sorted as c1 b2 a3. Because the first non-numeric characters are considered "empty numbers" and hence evaluate to 0. Commented Jul 30, 2017 at 20:57
  • @MusséRedi I understand your logic there, but that's not how it works. If the first character is a letter, the whole line is counted as a zero. Then, all of the different zero-equivalent lines are sorted, apparently using the normal alphanumeric rule. Commented Jul 30, 2017 at 21:04
  • @don_crissti He's thinking a3 b2 c103 02 0101 02 03... or back to c1 b2 a3. Commented Jul 30, 2017 at 21:08
  • The concept of empty number is not described in the manual, so I took a guess. In the manual, it only reads: an empty number is treated as '0'. I thought that a non-numeric character constituted an empty number. Commented Jul 30, 2017 at 21:29
  • 1
    @don_crissti I missed that because it talks about "key fields". It might be more clear if the -n option were documented using that same idiom. ("Use an initial numeric string as the sort key.") Edited now. Thanks. Commented Jul 30, 2017 at 22:10