Since TIMTOWTDI, you can also do this (slightly tested code)..
#!/usr/bin/perl use strict; use warnings; use NetAddr::IP; # Beware large IP sets... print join("\n", map { $_->addr } sort map { new NetAddr::IP $_ } <DAT +A>), "\n"; __DATA__ 10.1.5.2 10.1.1.2 10.1.0.1 10.1.1.0 10.1.1.1 10.1.5.1
Best regards
-lem, but some call me fokat
In reply to Re: ip sorting
by fokat
in thread ip sorting
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |