Wednesday, February 23, 2022

Sorting Org-Mode Tables

Start with any old table containing data.


  | fi     | fi     | fo    | fum |  
  | doodle | doodle | doole | dum |  
  | one    | fi     | fo    | fum |  
  | three  | fi     | fo    | fum |  
  | 7      | fi     | fo    | fum |  
  | cero   | fi     | fo    | fum |  

Say you want to sort it. Hmmm.

OK. So, to do that...

Put the cursor into the target column.

Press "C-c ^"

Follow the prompts to get the right sort of sort, which can be one of...

[a]lphabetic
[A]lphabetic (reverse)
[n]umeric
[N]umeric (reverse)
[t]ime (old to new)
[T]ime (new to old)

 

  
  Alphabetic Sort On First Column
  | 7      | fi     | fo    | fum |
  | cero   | fi     | fo    | fum |
  | doodle | doodle | doole | dum |
  | fi     | fi     | fo    | fum |
  | one    | fi     | fo    | fum |
  | three  | fi     | fo    | fum |

 

  
  Reverse Alphabetic Sort
  | three  | fi     | fo    | fum |
  | one    | fi     | fo    | fum |
  | fi     | fi     | fo    | fum |
  | doodle | doodle | doole | dum |
  | cero   | fi     | fo    | fum |
  | 7      | fi     | fo    | fum |
            

 

  
  Numeric Sort On First Column
  | fi     | fi     | fo    | fum |
  | doodle | doodle | doole | dum |
  | one    | fi     | fo    | fum |
  | three  | fi     | fo    | fum |
  | cero   | fi     | fo    | fum |
  | 7      | fi     | fo    | fum |
  

 

  
  Reverse Numeric Sort
  | 7      | fi     | fo    | fum |
  | fi     | fi     | fo    | fum |
  | doodle | doodle | doole | dum |
  | one    | fi     | fo    | fum |
  | three  | fi     | fo    | fum |
  | cero   | fi     | fo    | fum |
  

Pretty cool.

Inspiration from "Pragmatic Emacs", Sorting An Org-Mode Table

 


See tabs at the top for definitions and books.
Have anything worth adding? Then try sosayseff+nosey@nullabigmail.com
Me? Don't remember.