Sorting Text in GNU Emacs

At first glance, it might appear that Emacs can't deal with tabular data. But dig a little and you'll find Emacs has you covered for most day-to-day tasks.

For sorting text based on a column, select the column.

Then use M-x sort-columns.

 

You'll find that all the lines are sorted by that particular column.

For other available options, see online reference.

On a related note, case-fold-search works at a lower level for controlling case-insensitive search. At package level, it is mostly controlled by a package variable. e.g. for sort-columns, you need sort-fold-case for similar effect. So in case you find it's not working as per your expectations, you might want to dig into the documentation or code.

Comments

Popular posts from this blog

GNU Emacs as a Comic Book Reader

Data Visualization with GNU Emacs

Tinylisp and Multi-threaded Emacs