Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #10085
    user
    Participant

    hello

    in Emeditor, there is a feature to sort lines alphabetically or arithmetically, but how can I sort lines according to their length?

    thanks!

    #10087
    zhouzh2
    Participant

    Hi user,
    I wrote this macro for you:

    document.selection.EndOfDocument(false);
    endOfDocu = document.selection.GetActivePointY( eePosView );
    document.selection.StartOfDocument(false);
    document.selection.EndOfLine(false,eeLineView);
    currentCursor = document.selection.GetActivePointY( eePosView );
    while ( endOfDocu != currentCursor ) {
    currentCursor = document.selection.GetActivePointY( eePosView );
    numberOfChar = document.selection.GetActivePointX( eePosLogical ) - 1;
    document.selection.StartOfLine(false,eeLineView | eeLineHomeText);
    document.selection.Text=numberOfChar + ": ";
    document.selection.LineDown(false,1);
    document.selection.EndOfLine(false,eeLineView);
    }

    This macro will add numbers which indicate the number of characters of the line to the start of lines.
    After that,you can use the “sort” of emeditor.
    Than replace “^d+?:s” with NULL to restore orginial line.
    Hope it helps. :-)

    Cheers,
    angus.

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