I need to sort a table of contents that has multiple decimal points so that all the entries with no decimals are followed by the entries with two decimals etc.

For example
4
4.1
4.2
4.3
4.2.1
4.2.2
4.3.1
4.3.1.1
4.3.1.2.5
4.3.2
4.3.2.1
4.3.1.2

ends up like

4
4.1
4.2
4.3
4.2.1
4.2.2
4.3.1
4.3.2
4.3.1.1
4.3.1.2
4.3.2.1
4.3.1.2.5

I hope I made myself clear

thank you in advance
bil