How to sort IP addresses in Linux
Answer:
When you have a file ip.txt contains a list of IP addresses, e.g.
127.0.0.2
127.0.0.1
10.10.10.1
To sort it, you can use the following command
# sort -t. -k1,1n -k2,2n -k3,3n -k4,4n ip.txt
10.10.10.1
127.0.0.1
127.0.0.2
source: http://www.linuxask.com/questions/how-to-sort-ip-addresses-in-linux
Article Number: 4
Posted: Sun, May 20, 2018 9:25 AM
Last Updated: Mon, May 21, 2018 9:46 PM
Online URL: http://kb.ictbanking.net/article.php?id=4