- AuthorPosts
- February 3, 2013 at 3:03 pm #10808spirosParticipant
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://www.emeditor.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.February 4, 2013 at 6:59 pm #10810Yutaka EmuraKeymasterHello,
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!
February 5, 2013 at 9:29 am #10812spirosParticipantThank 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.
February 5, 2013 at 7:18 pm #10815Yutaka EmuraKeymasterHello,
Do you need to sort by line length of a specific column, or the length of a whole line?
February 6, 2013 at 12:29 am #10823spirosParticipantOf whole line. Many thanks, much indebted.
February 8, 2013 at 12:54 am #10825Yutaka EmuraKeymasterHello,
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!
February 10, 2013 at 11:12 pm #10831spirosParticipantWow, 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.
- AuthorPosts
- You must be logged in to reply to this topic.