Random sorting lines
Hello.
Need a macro to sort the rows in a random large files (10-1000 Mb). RAM of 2 Gb :-).
Thanks!
Hi TransUA,
to sort the lines alphabetically from A to Z, you can utilize the build-in functions from the Edit menu.
-
To randomly shuffle the lines, this basic JavaScript functions should work:
//Randomly shuffle lines //1.) select some text. 2.) execute this JavaScript macro. 3.) Done! strSelText = document.selection.Text; strLinebreak = "\r\n"; arrLinesArray = strSelText.split(strLinebreak); arrLinesArray.sort(function random(){return 0.5 - Math.random()}); arrOut = arrLinesArray.join(strLinebreak); document.selection.Text = arrOut;Store that above as shuffle.jsee into the EmEditor folder and load it via menu Macros > Select... Next select your text to shuffle and execute Macros > shuffle.jsee Note: you can find discussions about "better" or faster sort algorithms in the net and exchange my random function by another one. HTH?
2 posts in this topic