Has any one met such a problem to sort in notepad++?
The text file contains the following lines
0.00000E+00 0.00000E+00 1 4.89402E-02
0.00000E+00 0.00000E+00 3 9.41098E+01
0.00000E+00 0.00000E+00 5 4.22547E+03
0.00000E+00 0.00000E+00 2 7.41087E-06
0.00000E+00 0.00000E+00 4 2.69642E-03
0.00000E+00 0.00000E+00 6 5.35888E-04
0.30000E+02 0.30000E+02 1 2.96322E-02
0.30000E+02 0.30000E+02 3 1.15594E+02
0.30000E+02 0.30000E+02 5 3.30169E+03
0.30000E+02 0.30000E+02 2 7.86962E-03
0.30000E+02 0.30000E+02 4 7.54210E+00
0.30000E+02 0.30000E+02 6 2.03730E+02
0.60000E+02 0.60000E+02 1 4.60685E-03
0.60000E+02 0.60000E+02 3 1.46504E+02
0.60000E+02 0.60000E+02 5 1.31320E+03
0.60000E+02 0.60000E+02 2 4.81953E-04
0.60000E+02 0.60000E+02 4 9.01484E+00
0.60000E+02 0.60000E+02 6 8.16669E+01
0.90000E+02 0.90000E+02 1 7.26858E-05
0.90000E+02 0.90000E+02 3 1.55457E+02
0.90000E+02 0.90000E+02 5 2.43385E+02
0.90000E+02 0.90000E+02 2 3.59327E-03
0.90000E+02 0.90000E+02 4 4.52146E-04
0.90000E+02 0.90000E+02 6 1.65717E-02
0.12000E+03 0.12000E+03 1 7.07527E-03
0.12000E+03 0.12000E+03 3 1.46518E+02
0.12000E+03 0.12000E+03 5 1.30634E+03
0.12000E+03 0.12000E+03 2 6.14906E-03
0.12000E+03 0.12000E+03 4 8.93463E+00
0.12000E+03 0.12000E+03 6 8.16950E+01
...
I need to sort the lines to locally 1~6 on 3rd column
0.00000E+00 0.00000E+00 1 4.89402E-02
0.00000E+00 0.00000E+00 2 7.41087E-06
0.00000E+00 0.00000E+00 3 9.41098E+01
0.00000E+00 0.00000E+00 4 2.69642E-03
0.00000E+00 0.00000E+00 5 4.22547E+03
0.00000E+00 0.00000E+00 6 5.35888E-04
0.30000E+02 0.30000E+02 1 2.96322E-02
0.30000E+02 0.30000E+02 2 7.86962E-03
0.30000E+02 0.30000E+02 3 1.15594E+02
0.30000E+02 0.30000E+02 4 7.54210E+00
0.30000E+02 0.30000E+02 5 3.30169E+03
0.30000E+02 0.30000E+02 6 2.03730E+02
...
I tried to find what: ^(( +\d.\d+E[+|-]\d+){2}) +1(( +-?\d.\d+E[+|-]\d+){1})\r\n^(( +\d.\d+E[+|-]\d+){2}) +3(( +-?\d.\d+E[+|-]\d+){1})\r\n Replace with: \1 1\3\r\n....
But too many tags which I don't think working.
Has any one met such a problem to sort in notepad++
I have to admit: I have from time to time used Notepad++ for such tasks, when I was too lazy for writing an awk
, sed
or python
script. If the task becomes a tiny bit more complicated then a real scripting language or spreadsheet is the only way.
But depending on how many lines you have (say a few thousand and not a million) this trick might be worth trying out in Notepad++:
(([0-9.]+E[-+][0-9]+[ ]+){2})([1-6])(.*)
\3 : \1\3\4
[1-6] :
with empty stringThe trick is:
And step one is needed so that we can use the sorting feature from the menu in the macro.