|
|
| Just another Perl shrine | |
| PerlMonks |
How to merge data in IP address pairsby -=Markus=- (Initiate) |
| on May 27, 2012 at 13:32 UTC ( #972701=perlquestion: print w/ replies, xml ) | Need Help?? |
|
-=Markus=- has asked for the
wisdom of the Perl Monks concerning the following question:
Hi all,
I'm a Perl newbie and would have a question about data merging and finding reverse IP pairs. I have a tab separated list of network traffic containing source IP, destination IP and bytes transferred between the peers as follows:
I would need to aggregate the data (bytes) for each session (= source/destination IP pair = destination/source IP pair). In the above example data the last two lines should be aggregated as follows:
=>
The order of the IPs doesn't matter. Finally the complete list of all data should be printed. Based on the above example the source data should finally be shown as:
I've created the following solution:
That works well for a small amount of data (for few thousands of lines) but is basically unusable for vast amount of data (I have over 77M lines to process). I have been struggling to find a proper solution for the issue for the last three days but haven't progressed much. I would highly appreciate any help on this one. Thanks in advance! :) Br, -=Markus=-Ps. How the same (aggregation of all data columns) can be done for data containing multiple columns? Like:
Back to
Seekers of Perl Wisdom
|
|
||||||||||||||||||||||||||