Hello all,
I have a script where I am running a very large text file being writen into an array. The seven element of that array is a hostname. There are many entries with the same hostname in the file. I want to count the occurances of each hostname and end up with an output like:
hostname1 1089
hostname2 12098
hostname3 10
.
.
.
.
etc.
This is what I have so far:
Obviously not much.
Here is a sample of the results of the command:
Thanks in advance.
Nick
If at first you don't succeed, don't try skydiving.
I have a script where I am running a very large text file being writen into an array. The seven element of that array is a hostname. There are many entries with the same hostname in the file. I want to count the occurances of each hostname and end up with an output like:
hostname1 1089
hostname2 12098
hostname3 10
.
.
.
.
etc.
This is what I have so far:
Code:
my @arry = `$OV_BIN/ovdumpevents 2>&1`;
foreach (@arry) {
print LOG "$_\n";
}
Obviously not much.
Here is a sample of the results of the command:
Code:
1184594414 1 Mon Jul 16 10:00:14 2007 csabxxxxx.private.company.com - Received event Ent-.1.3.6.1.4.1.9.1.501. 4 args: [1] mgmt.mib-2.interfaces.ifTable.ifEntry.ifIndex.140 (Integer): 140 [2] mgmt.mib-2.interfaces.ifTable.ifEntry.ifDescr.140 (OctetString): GigabitEthernet5/41 [3] mgmt.mib-2.interfaces.ifTable.ifEntry.ifType.140 (Integer): ethernetCsmacd [4] private.enterprises.cisco.local.linterfaces.lifTable.lifEntry.locIfReason.140 (OctetString): up;1 .1.3.6.1.6.3.1.1.5.4.1.3.6.1.4.1.9.1.501 0
1184594414 1 Mon Jul 16 10:00:14 2007 csab2yyyy.private.company.com - Received event Ent-.1.3.6.1.4.1.9.1.501. 4 args: [1] mgmt.mib-2.interfaces.ifTable.ifEntry.ifIndex.140 (Integer): 140 [2] mgmt.mib-2.interfaces.ifTable.ifEntry.ifDescr.140 (OctetString): GigabitEthernet5/41 [3] mgmt.mib-2.interfaces.ifTable.ifEntry.ifType.140 (Integer): ethernetCsmacd [4] private.enterprises.cisco.local.linterfaces.lifTable.lifEntry.locIfReason.140 (OctetString): up;1 .1.3.6.1.6.3.1.1.5.4.1.3.6.1.4.1.9.1.501 0
1184594416 1 Mon Jul 16 10:00:16 2007 csab3zzzz.private.company.com - Received event Ent-.1.3.6.1.4.1.9.1.501. 4 args: [1] mgmt.mib-2.interfaces.ifTable.ifEntry.ifIndex.28 (Integer): 28 [2] mgmt.mib-2.interfaces.ifTable.ifEntry.ifDescr.28 (OctetString): GigabitEthernet3/25 [3] mgmt.mib-2.interfaces.ifTable.ifEntry.ifType.28 (Integer): ethernetCsmacd [4] private.enterprises.cisco.local.linterfaces.lifTable.lifEntry.locIfReason.28 (OctetString): up;1 .1.3.6.1.6.3.1.1.5.4.1.3.6.1.4.1.9.1.501 0
Thanks in advance.
Nick
If at first you don't succeed, don't try skydiving.