in reply to Re: How do I sort a file with IP Addresses and another text column
in thread How do I sort a file with IP Addresses and another text column?

I'd just like to add to this excellent answer...If you've just got a list of IP addresses to sort -- not two IP addresses plus a country -- here's how you'd do it:

print map{sprintf(("%d.%d.%d.%d")."%s\n",(split/,/)\[0..3\])} sort map{sprintf"%3d,"x4,(split/\W/)\[0..3\]}

It took a lot of scratching my head to adapt this, so I thought I'd save the next person the trouble. Hope it's useful!

  • Comment on Re: Answer: How do I sort a file with IP Addresses and another text column
  • Download Code