strat.minger has asked for the wisdom of the Perl Monks concerning the following question:
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.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Sorting IP Subnets together
by ikegami (Patriarch) on Apr 12, 2007 at 16:21 UTC | |
by ikegami (Patriarch) on Apr 12, 2007 at 16:41 UTC | |
|
Re: Sorting IP Subnets together
by jettero (Monsignor) on Apr 12, 2007 at 15:33 UTC | |
|
Re: Sorting IP Subnets together
by strat.minger (Initiate) on Apr 17, 2007 at 08:43 UTC | |
|
Re: Sorting IP Subnets together
by strat.minger (Initiate) on Apr 17, 2007 at 12:15 UTC |