Hi All,

 

I'm not very familiar with Perl yet, so could someone help me with this
please? I have a file which has two columns one called Basenumber the
other Rating (Rating.txt), how do I loop through and get an average for
the Rating column for each distinct baseNumber? I want to write the new
result out into a new file called AvgRatings.txt. Thanks in advance for
any help on this. 

 

Rating.txt:

 

Basenumber|Rating

10000|5

10000|4

10000|5

10007|4

10007|5

10007|4

10007|5

10008|4

10008|3

10008|2

10008|1

 

The new file (AvgRatings.txt) should looks like this:

 

Basenumber|AvgRating

10000|4.67

10007|4.5

10008|2.5

 

 

Best regards,

 

Mike Tran

e: [EMAIL PROTECTED]

t: (307) 772-8956 


 

 

Reply via email to