<?xml version="1.0" encoding="windows-1252"?>
<node id="737697" title="Re: Tally up the number of times each IP shows up in the file and load into HASH" created="2009-01-20 16:57:33" updated="2009-01-20 16:57:33">
<type id="11">
note</type>
<author id="224409">
borisz</author>
<data>
<field name="doctext">
Not sure if I understand what you want to do. But here is my try.

&lt;c&gt; script.pl &lt; path.csv &lt;/c&gt;

&lt;c&gt;
use strict;
use warnings;
my %h;
while (&lt;&gt;) {
  my ( $k, @ips ) = split /\s+/;
  $k =~ s/(_.*)$//;
  $h{$k}{$_}++ for @ips;
}
for my $srv ( sort keys %h ) {
  for ( sort keys %{ $h{$srv} } ) {
    printf( "%10s %15s %6s\n", $srv, $_, $h{$srv}{$_} );
  }
}
&lt;/c&gt;

&lt;c&gt;
__OUTPUT__
   11BT801    10.197.28.38      1
   11BT801     10.197.5.82      2
   11BT801    10.200.10.10      1
   11BT801    10.200.10.11      1
   11BT801     10.200.6.42      2
   11BT801     10.200.6.50      1
   11BT801     10.200.8.26      2
   12GT601     10.100.7.14      1
   12GT601     10.100.9.16      2
   12GT601     10.160.9.16      1
   12GT601     10.180.7.13      1
   12GT601    10.197.27.36      1
   12GT601     10.197.5.82      2
   12GT601    10.200.10.10      1
   12GT601     10.200.5.40      2
&lt;/c&gt;

&lt;!-- Node text goes above. Div tags should contain sig only --&gt;
&lt;div class="pmsig"&gt;&lt;div class="pmsig-224409"&gt;
Boris
&lt;/div&gt;&lt;/div&gt;</field>
<field name="root_node">
737693</field>
<field name="parent_node">
737693</field>
</data>
</node>
