Skip to content

Instantly share code, notes, and snippets.

@jungle-boogie
Created June 15, 2015 01:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jungle-boogie/f899acae799359f20711 to your computer and use it in GitHub Desktop.
Save jungle-boogie/f899acae799359f20711 to your computer and use it in GitHub Desktop.
sorting issue with csv.vim
trans_count,trans_amount,portal_fee,sum
70,3.50,16.50,20
291,14.55,5.45,20
583,29.15,0,29.15
694,34.70,0,34.7
67,3.35,16.65,20
4431,132.93,0,132.93
142,7.10,12.90,20
379,18.95,1.05,20
22,1.10,18.90,20
8,0.40,19.60,20
27,1.35,18.65,20
121,6.05,13.95,20
3,0.15,19.85,20
487,24.35,0,24.35
2,0.10,19.90,20
486,24.30,0,24.3
416,20.80,0,20.8
5,0.25,19.75,20
732,36.60,0,36.6
761,38.05,0,38.05
264,13.20,6.80,20
161,8.05,11.95,20
40,2,18,20
77,3.85,16.15,20
1,0.05,19.95,20
62,3.10,16.90,20
135,6.75,13.25,20
7,0.35,19.65,20
548,27.40,0,27.4
21,1.05,18.95,20
701,35.05,0,35.05
468,23.40,0,23.4
432,21.60,0,21.6
351,17.55,2.45,20
1415,70.75,0,70.75
4,0.20,19.80,20
3,0.15,19.85,20
544,27.20,0,27.2
71,3.55,16.45,20
709,35.45,0,35.45
160,8,12,20
422,21.10,0,21.1
144,7.20,12.80,20
5043,151.29,0,151.29
542,27.10,0,27.1
798,39.90,0,39.9
405,20.25,0,20.25
14,0.70,19.30,20
109,5.45,14.55,20
340,17,3,20
525,26.25,0,26.25
513,25.65,0,25.65
5,0.25,19.75,20
11,0.55,19.45,20
17,0.85,19.15,20
731,36.55,0,36.55
334,16.70,3.30,20
1,0.05,19.95,20
3207,96.21,0,96.21
235,11.75,8.25,20
1187,59.35,0,59.35
519,25.95,0,25.95
371,18.55,1.45,20
2083,62.49,0,62.49
58,2.90,17.10,20
49,2.45,17.55,20
335,16.75,3.25,20
493,24.65,0,24.65
691,34.55,0,34.55
346,17.30,2.70,20
10,0.50,19.50,20
118,5.90,14.10,20
4,0.20,19.80,20
488,24.40,0,24.4
199,9.95,10.05,20
135,6.75,13.25,20
971,48.55,0,48.55
419,20.95,0,20.95
562,28.10,0,28.1
61,3.05,16.95,20
103,5.15,14.85,20
781,39.05,0,39.05
561,28.05,0,28.05
473,23.65,0,23.65
26,1.30,18.70,20
238,11.90,8.10,20
527,26.35,0,26.35
824,41.20,0,41.2
4,0.20,19.80,20
830,41.50,0,41.5
235,11.75,8.25,20
1249,62.45,0,62.45
599,29.95,0,29.95
226,11.30,8.70,20
384,19.20,0.80,20
5011,150.33,0,150.33
175,8.75,11.25,20
50,2.50,17.50,20
515,25.75,0,25.75
73,3.65,16.35,20
1,0.05,19.95,20
5,0.25,19.75,20
1,0.05,19.95,20
404,20.20,0,20.2
2584,77.52,0,77.52
1383,69.15,0,69.15
154,7.70,12.30,20
261,13.05,6.95,20
108,5.40,14.60,20
489,24.45,0,24.45
872,43.60,0,43.6
808,40.40,0,40.4
785,39.25,0,39.25
222,11.10,8.90,20
538,26.90,0,26.9
173,8.65,11.35,20
135,6.75,13.25,20
594,29.70,0,29.7
223,11.15,8.85,20
523,26.15,0,26.15
45,2.25,17.75,20
45,2.25,17.75,20
629,31.45,0,31.45
134,6.70,13.30,20
1339,66.95,0,66.95
1344,67.20,0,67.2
1735,52.05,0,52.05
654,32.70,0,32.7
2,0.10,19.90,20
71,3.55,16.45,20
723,36.15,0,36.15
157,7.85,12.15,20
542,27.10,0,27.1
493,24.65,0,24.65
:Sort! on the first column and you'll notice 971 appears first but on line 47 we have a total of 5043.
It appears the sorting is doing this: https://en.wikipedia.org/wiki/Lexicographical_order
@jungle-boogie
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment