I am performing some actions on these IP's but ideally I would like to do it by subnet. All the IP Addresses on the network belong to a /29 subnet. I am using NetAddr::IP to then get the network address that corresponds to each individual IP. The list could look like this10.0.0.1 555555 10.2.1.6 444444 10.6.2.8 333333 10.2.1.2 222222 etc...
I now want to group together all the lines that have the same network address and add up the bytes transfered. This in theory would like something like:10.0.0.0/29 10.0.0.1 555555 10.2.1.0/29 10.2.1.6 444444 10.6.2.0/29 10.6.2.8 333333 10.2.1.0/29 10.2.1.2 222222 etc...
I then need to run these through some more processes that I have working on the individual IP Addresses at the moment. The problem is that there are a very large amount of IP's and subnets, and they can change over every measurement period as can the data transfered.10.2.1.0/29 666666 10.0.0.0/29 555555 10.6.2.0/29 333333
At the moment I am trying to use arrays and foreach loops etc.. to try and get this working.
Any help as I struggle on with this would be appreciated.
In reply to Sorting IP Subnets together by strat.minger
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |