How to sort ip addresses

I don't know where I found this solution but it is very easy to remember.

$ cat ip_file
$ sort -t. +0n -1n +1n -2n +2n -3n +3n ip_file
Milosz Galazka's Picture

About Milosz Galazka

Milosz is a Linux Foundation Certified Engineer working for a successful Polish company as a system administrator and a long time supporter of Free Software Foundation and Debian operating system. He is also open for new opportunities and challenges.

Gdansk, Poland