Ubuntu – How to sort lines in a text file alphabetically with gedit

gedit

With Ubuntu's gedit text editor how can I sort lines in a text file alphabetically?

Best Answer

answer for gedit 3.10.4 - ubuntu 14.04 && gedit 3.18.3 - ubuntu 16.04

you'll first have to install a plugin for gedit. it just takes a few clicks and no reboot.

  1. Open gedit

  2. Click Edit, select Preferences

  3. Click Plugins, check Sort

  4. Open the text file you want to work with or be sure changes are saved before you test it as you're unable to undo anything after sorting with gedit. (update - it seems that changes can be reverted in 16.04, not sure since what gedit version)

  5. If you want to sort a portion of the file, highlight what you want sorted else leave all selected by default.

  6. (gedit 3.10.4 - ubuntu 14.04) Click Edit, Click Sort..., Click Sort

    (gedit 3.18.3 - ubuntu 16.04) Click Tools, Click Sort..., Click Sort

Related Question