Sorting columns numerically
-
Hi, I need help, I want to sort a list, but the numbers that I want to sort are in a different column, how I can achieve the sorting?, here is the text that I’m refering:
Blazing Nova [NEW!] Total= 058
AutoMag .44 Total= 046
KelTec KSG-12 Total= 116
FAMAS G2 Platinum Total= 097
Transcendent Magnum Drill GoldTotal= 038
Barrett M107 Platinum Total= 031
SG-552 Cerberus [NEW!] Total= 069
AK-47 Paladin Chimera Total= 035
AA-12 Gold Total= 013
M4A1 Dark Knight Chimera Total= 035
Mk. 14 EBR Gold Total= 029
Barrett M95 White Tiger Total= 183
M249 Phoenix Total= 040
AWP Elven Ranger Total= 151
AUG Guardian Total= 063
SCAR OZ-D Total= 101
SG-552 Lycanthrope Total= 092
Barrett M95 Ghost Knight Total= 139
Desert Eagle Crimson Hunter Chimera Total= 087
M4A1 Dark Knight Total= 092
AK-47 Paladin Total= 126
Tempest Total= 401
XM556 Microgun Total= 043
[Half-Life 2] Combine Emplacement Gun Total= 044
[Half-Life 2] MP7 Total= 730
[Insurgency] L85A2-L123A2 Total= 050
[Insurgency] M79 Total= 133
Pacman-Launcher Total= 104
Jetpack Total= 012
[Counter-Strike 1.6] Knife Total= 131
[Counter-Strike 1.6] C4 Total= 011
[Counter-Strike 1.6] AK-47 Total= 216
[Counter-Strike 1.6] M4A1 Total= 253
[Counter-Strike 1.6] P90 Total= 024I want them to sort like:
xxxxxx Total= 010
xxxxxx Total= 015
xxxxxx Total= 037Thanks!
-
It’s doable with RegEx, but not in one step, as follows:
a) Open the
Replace
dialog (Ctrl + H) and type:Search: (?-s).* (\d+)$ Replace: $1 $0
Put the caret at the very beginning of the document, select the
Regular Expression mode
and click onReplace All
. You will get a new list like058 Blazing Nova [NEW!] Total= 058 046 AutoMag .44 Total= 046 116 KelTec KSG-12 Total= 116 097 FAMAS G2 Platinum Total= 097 038 Transcendent Magnum Drill GoldTotal= 038 ...
b) Choose
Edit
>Sort Lines as Integers Ascending
, to get011 [Counter-Strike 1.6] C4 Total= 011 012 Jetpack Total= 012 013 AA-12 Gold Total= 013 024 [Counter-Strike 1.6] P90 Total= 024 029 Mk. 14 EBR Gold Total= 029
c) Lastly, remove the auxiliary integers with this other RegEx —same instructions as above—:
Search: (?-s)^(\d+)\x20 Replace: [leave empty]
That’s all.
-
@astrosofista said in Sorting columns numerically:
Sort Lines as Integers Ascending
Thanks a lot, works flawlessly!