Emacs: Sort Lines

By Xah Lee. Date: .
Alt+x sort-lines

Sort lines in text selection.

Alt+x reverse-region

Reverse lines order in text selection.

Alt+x sort-numeric-fields

Sort lines by a specific column, as number.

For example: Type Ctrl+u, then 2, then Alt+x sort-numeric-fields. This will sort the line by the 2nd column, and the fields are compared as numbers.

Alt+x sort-fields

Sort lines by a specific column, as string.

(“fields” are separated by space or tabs. First field is 1.)

Emacs, Work on Lines