Hi,
I am wanting to find uniqueness in a csv file.
Detail:
the csv file looks loke this..
DATE,Time,Name,Location
03/03/2001,08:00:00,Server1,DBN
04/03/2001,13:20:13,Server1,DBN
04/03/2001,15:35:00,Server2,CPT
04/03/2001,16:00:16,Server1,JHB
etc...
I want to do something different if there are other names in the Name field.. if there is only 1 unique name I want to count how many DBN's there are ... if there are more than 1 name in the Name field I want to do something else..
I am most interested in finding whether the name in the Name field is unique or if there are others in the same field also...
here is what I have so far...
now I can see $row[3] but how do I compare it to the next row or the ones after it ...??
Rgds
Sean
I am wanting to find uniqueness in a csv file.
Detail:
the csv file looks loke this..
DATE,Time,Name,Location
03/03/2001,08:00:00,Server1,DBN
04/03/2001,13:20:13,Server1,DBN
04/03/2001,15:35:00,Server2,CPT
04/03/2001,16:00:16,Server1,JHB
etc...
I want to do something different if there are other names in the Name field.. if there is only 1 unique name I want to count how many DBN's there are ... if there are more than 1 name in the Name field I want to do something else..
I am most interested in finding whether the name in the Name field is unique or if there are others in the same field also...
here is what I have so far...
Code:
$CSV='C:/TEMP/tst.csv";
# Open CSV that was created Earlier
open CSV or die "Cannot open $CSV for read $!";
$num = 0;
while (<CSV>) {
# Create an array from each line with the ',' as the seperator
@row = split /,/ ;
$num++ ;
}
now I can see $row[3] but how do I compare it to the next row or the ones after it ...??
Rgds
Sean