Sorting

jed is capable of sorting a region of lines using the heapsort algorithm. The region is sorted alphabetically based upon the ASCII values of the characters located within a user defined rectangle in the region. That is, the rectangle simply defines the characters upon what the sort is based. Simply move to the top line of the region and set the mark on the top left corner of the rectangle. Move to the bottom line and place the point at the position which defines the lower right corner of the rectangle. Press ESC X to get the M-x prompt and enter sort As as example, consider the following data:

      Fruit:             Quantity:
      lemons                3
      pears                37
      peaches             175
      apples              200
      oranges              56

To sort the data based upon the name, move the Point to the top left corner of the sorting rectangle. In this case, the Point should be moved to the l in the word lemons. Set the mark. Now move to the lower right corner of the rectangle which is immediately after the s in oranges. Pressing ESC X and entering sort yields:

      Fruit:             Quantity:
      apples              200
      lemons                3
      oranges              56
      peaches             175
      pears                37

Suppose that it is desired to sort by quantity instead. Looking at the original (unsorted) data, move the Point to two spaces before the 3 on the line containing lemons. The cursor should be right under the u in Quantity. Set the mark. Now move the Point to immediately after 56 on the oranges line and again press ESC X and enter sort. This yields the desired sort:

      Fruit:             Quantity:
      lemons                3
      pears                37
      oranges              56
      peaches             175
      apples              200