Red Hat Bugzilla – Bug 901517
is not this sorting incorrect?
Last modified: 2016-09-20 00:32:45 EDT
Is not the sort broken or did I miss some option?
Below is the patch file. The update was generated by a script. Though I can not guarantee that the original file from several months or years ago was generated by the same script but it seems it might be.
I tried to use different sort options and combine that with either field separator ":" or no separator option but was unable to produce the original sorting order to reduce the patch size. The new sort order seems to be rather incorrect to move the 0:0:1 past 0:0:1f on numeric sort on both field separator : or no separator.
diff -up ./ethercodes.dat.orig ./ethercodes.dat
--- ./ethercodes.dat.orig 2013-01-18 11:31:10.998394976 +0100
+++ ./ethercodes.dat 2013-01-18 11:45:28.466851677 +0100
@@ -1,5 +1,4 @@
0:0:0 XEROX CORPORATION
-0:0:1 XEROX CORPORATION
0:0:10 SYTEK INC.
0:0:11 NORMEREL SYSTEMES
0:0:12 INFORMATION TECHNOLOGY LIMITED
@@ -16,7 +15,7 @@
0:0:1d CABLETRON SYSTEMS, INC.
0:0:1e TELSIST INDUSTRIA ELECTRONICA
0:0:1f Telco Systems, Inc.
-0:0:2 XEROX CORPORATION
+0:0:1 XEROX CORPORATION
0:0:20 DATAINDUSTRIER DIAB AB
0:0:21 SUREMAN COMP. & COMMUN. CORP.
0:0:22 VISUAL TECHNOLOGY INC.
@@ -33,7 +32,7 @@
0:0:2d CHROMATICS INC
0:0:2e SOCIETE EVIRA
0:0:2f TIMEPLEX INC.
-0:0:3 XEROX CORPORATION
+0:0:2 XEROX CORPORATION
0:0:30 VG LABORATORY SYSTEMS LTD
0:0:31 QPSX COMMUNICATIONS PTY LTD
0:0:32 Marconi plc
sounds like a locale issue.
Try with: LC_ALL=C sort ...
Note sorting variable width hex is not directly supported by sort unfortunately
It would be better to have the original files rather than the patch, still, I don't see a bug in sort here. As Pádraig said, locales influence the sorting order.