March 16, 2007

[Shell Script] Sort IP Addresses

# cat host
140.117.1.77
140.117.11.7
140.1.99.1
# sort host
140.117.11.7
140.117.1.77
140.1.99.1
# sort -t. -nk1,1 -k2,2 -k3,3 -k4,4 host
140.1.99.1
140.117.1.77
140.117.11.7

Posted by pank at March 16, 2007 04:18 PM
Comments
Post a comment













Remember personal info?