for lines with same number of columns separated by a dot delimiter, like
aa.bb
cc.dd
...
it's easy to sort by last column
sort -t. -k2,2 file
if the text file have different "columns", like
aa.b.xb
cc.dd
xx.cc.aa
a.b.c.d.e
...
then how to sort the lines by the last "column"
xx.cc.aa
cc.dd
a.b.c.d.e
aa.b.xb
...
You can make use of the Schwartzian transform in bash
.
awk -F. '{print $NF "\t" $0}' file | sort -k1,1 | cut -f2-
cut
command.