In Linux there is a simple command which you can utilize it to sort the content of your text file(s). This command is included in coreutils and the name is sort.
The use of sort command is like below,
$ sort myfile.txt
The output will show the sorted file in ascending order.
If you want to get it in descending order just add -r
parameter before file name like,
$ sort -r myfile.txt
Sort command is also able to sort by an especial tab and has many more options.
More information is available on sort command man page.