2009-10-11

Sort and uniquify lines in Emacs.

For only sort lines exist built-in func: C-x sort-lines.

Sort and uniquify lines:

  • select region
  • C-u M-| sort -u RET

With transient-mark-mode and delete-selection-mode enabled:

  • select region
  • M-| sort -u RET
to replace selection with sorted and uniquified lines.