sort lines according to their length
Is there a way to do that? I have a txt file tab separated with 10 columns and 100,000 rows. I tried this macro
http://emeditor.wpengine.com/modules/newbb/viewtopic.php?topic_id=1961&forum=2 but gave me errors. I also tried Edit -> seperated values sort -> smallest to largest but the results were not good, i.e. not sorted according to length of line.
http://emeditor.wpengine.com/modules/newbb/viewtopic.php?topic_id=1961&forum=2 but gave me errors. I also tried Edit -> seperated values sort -> smallest to largest but the results were not good, i.e. not sorted according to length of line.
Hello,
If you would like to sort according to length of line, you will have to write a macro to sort in that way. Would you like me to write sucn that macro? If so, please write the specification requirements for the macro. Thank you!
If you would like to sort according to length of line, you will have to write a macro to sort in that way. Would you like me to write sucn that macro? If so, please write the specification requirements for the macro. Thank you!
Thank you, I would appreciate it if you could. The specs is that it should be able to handle that specific file with 80 MB size, tab delimited with 10 columns, UTF-8 non-Latin text, and with line length ranging from 200 characters to 80,000.
Hello,
Do you need to sort by line length of a specific column, or the length of a whole line?
Do you need to sort by line length of a specific column, or the length of a whole line?
Of whole line. Many thanks, much indebted.
Hello,
This macro should sort the selected text from long to short.
If you want to sort lines from short to long, please use this:
Please select the whole document (CTRL + A) before you run this macro if you want to sort the entire document.
Thanks!
This macro should sort the selected text from long to short.
document.selection.text = ((document.selection.text.split("n")).sort(function(a,b){return b.length-a.length})).join('n');If you want to sort lines from short to long, please use this:
document.selection.text = ((document.selection.text.split("n")).sort(function(a,b){return a.length-b.length})).join('n');Please select the whole document (CTRL + A) before you run this macro if you want to sort the entire document.
Thanks!
Wow, it worked in 2 seconds! Thank you so much.
Perhaps you could consider adding it as a sorting function in the "Separated values/Sort" menu item.
Perhaps you could consider adding it as a sorting function in the "Separated values/Sort" menu item.
7 posts in this topic