Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #10808
    spiros
    Participant

    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.

    #10810
    Yutaka Emura
    Keymaster

    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!

    #10812
    spiros
    Participant

    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.

    #10815
    Yutaka Emura
    Keymaster

    Hello,

    Do you need to sort by line length of a specific column, or the length of a whole line?

    #10823
    spiros
    Participant

    Of whole line. Many thanks, much indebted.

    #10825
    Yutaka Emura
    Keymaster

    Hello,

    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!

    #10831
    spiros
    Participant

    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.

Viewing 7 posts - 1 through 7 (of 7 total)
  • You must be logged in to reply to this topic.