Emacs can sort lines, paragraphs, pages. It can sort by fields, columns or even regexp. There are predefined Emacs commands to all of these things.
‘M-x sort-lines’‘C-x h M-x sort-lines’‘C-u M-x sort-lines’‘M-x sort-numeric-fields’‘M-x sort-numeric-fields M-x reverse-region’‘M-x sort-paragraphs’‘C-u M-x sort-paragraphs’‘M-x sort-pages’‘C-u M-x sort-pages’‘C-u 2 M-x sort-field’‘C-u 2 M-x sort-field M-x reverse-region’‘M-x sort-columns’‘C-u M-x sort-columns’In addition to these commands, there are other functions in EmacsLisp available for sorting text. The general ‘sort’ function can sort lists of Lisp objects, see DestructiveOperations or the ElispCookbook for examples.
See nodes ‘Sorting’ in the EmacsManual and ‘Sorting’ in the Elisp manual, for details: Sorting.
See node ‘Rearrangement’ in the Elisp manual for details: Rearrangement.
See Also: