Sorting

Home Forums Multi-Edit Suggestions Sorting

This topic contains 5 replies, has 5 voices, and was last updated by  Andrew Capozzoli 4 weeks, 1 day ago.

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #1559

    Leslie Satenstein
    Participant

    Just to request that as much as possible the original sequence is respected.

    I had some fields such as (unix crontab entries)

    10 30
    00 30
    15 30
    10 00

    I first sorted by columns 1-2 and got good results. (Low key)
    Then I sorted by columns 4-5 and got those rows sorted, but the initial sort order for equal fields was not respected.

    I ended up with
    10 00
    15 30
    00 30

    When I wanted

    10 00
    00 30
    15 30

    Have a nice sort of day

    Les

    #5630

    tlscales
    Participant

    Seems to me that ME is doing exactly what it’s supposed to do here. What you are looking for is the ability to specify multiple sort keys (otherwise, how does the code know what part of the non-key data you want to respect the ortdering of?).

    A quick and dirty way to get the result you want would be to temporarily move columns 1-2 after column 5, which would leave you with:

    30 10
    30 00
    30 15
    00 10

    then sort on columns 1-5, then move the columns back to the original order.

    #5631

    Leslie Satenstein
    Participant

    I beg to differ with your reply, and I do not want to move columns around­.

    Any Operating system sort will respect the original file row order when keys are equal. Multi-edit sort should do the same. Thus, when I sort by minor key first and have that in order, and then by major fields, the rows with duplicates (on 2nd sort) should respect the previous setl row sequence/order.

    #5685

    ReidSweatman
    Participant

    Well, it’s not exactly true that any sort algorithm will maintain previously-existing order. A bubble sort will, for instance, but a QuickSort won’t, and that’s the algorithm Multi-Edit uses.

    #5845

    Bret Sutton
    Participant

    Just in case Multi-Edit sticks with QuickSort, here’s a kludge to retain the sort order you desire. Insert some columns into your file immediately after the columns you want to sort on. Use the Block Number feature to number them sequentially. Then sort on your columns plus the numbered columns.

    If you want to be able to sort on multiple sets of columns simultaneously, and even do mixed ascending/descending sorts, you may be interested in the sort enhancement posted here:
    [url:10zrzbix]http://www.multieditsoftware.com/forums/viewtopic.php?t=819[/url:10zrzbix]

    #24822

    Andrew Capozzoli
    Participant

    Wow its my favorite blog according to topic because i like the sorting of anything because its become efficient to sort out any thing if you always practically. In the computer its beneficial australian assignment help role play very important we can sort out the questions and answer also without waste of time.

Viewing 6 posts - 1 through 6 (of 6 total)

You must be logged in to reply to this topic.