In Geany 1.27 (the version in 16.04), select the text then Edit > Format > Send to > sort -u (or to a custom command if the user has set up one).

I used Gedit quite a bit until an update rendered several plug-ins non-functional by design.