in reply to Re: Sort in IP in 2 lines.
in thread Sort in IP in 2 lines.
Uh... that doesn't sort IPs in the way you might expect IPs to be sorted...
perl -le 'print for sort{($a=~/(\d+(\.\d+){3})/)[0]cmp($b=~/(\d+(\.\d+ +){3})/)[0]} qw(1.2.3.4 1.12.3.4);' 1.12.3.4 1.2.3.4
In fact, it doesn't do much of anything except a run-of-the-mill asciibetical sort of lines based on the first portion of them that looks somewhat like an IP.
I can't believe that this has sat around for almost two years without reply... I hope no one out there has actually used it!
-sauoq "My two cents aren't worth a dime.";
|
|---|