With Ubuntu's gedit text editor how can I sort lines in a text file alphabetically?
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.
Click Edit, select Preferences
Click Plugins, check Sort
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)
If you want to sort a portion of the file, highlight what you want sorted else leave all selected by default.
(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