Sort IPs

I was doing some research on spam again and had to do some stuff with a couple of IP Addresses. That’s where “sort” came in handy as a tool to do what its name suggests.

sort -n -t . -k 1,1 -k 2,2 -k 3,3 -k 4,4 somefile.txt

This snippet only works if the text file got the IPs writtin in the first column.

Share

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *

Notify me of followup comments via e-mail. You can also subscribe without commenting.