Thanks for the help
willyw.
Now that I think about it, I realize that my code will not work properly ...
The values that are stored are daily and correspond to the points obtained by each of the nicksnames.
On the same day, a nickname can get different scores ...
I think the script should be more complex and when retrieving the data, averaging between the values of each nick, and then ordering them at the end of the month.
The daily content of the ranking file will look something like this:
Ana 5
Pedro 9
Jose 18
Luis 3
Maria 22
Ana 15
Maria 3
Jose 2
Pedro 10
Ana 11
Pedro 4
Luis 3
Maria 15
Maria 18
Ana 14
Maria 3
Ana 2
From these data, I want to get the average of ordered values of each nick.
Pedro's average 9+10+4= 23 23/3= 7.66 Rounded value 8
Jose's average 18+2= 20 20/2= 10
Luis's average 3+3= 6 6/2= 3
Maria's average 22+3+15+18+3= 61 61/5= 12.2 Rounded value 12
Ana's average 15+11+14+2= 42/4= 10.5 Rounded value 10
I think the best way to store the points of each nick is horizontal line (Excel spreadsheet style), to facilitate calculations without repeating the nicks name.
Example:
Pedro 9 10 4
Jose 18 2
Luis 3 3
Maria 22 3 15 18 3
Ana 15 11 14 2
Final result ordered and averaged:
Pedro 8
Jose 10
Luis 3
Maria 12
Ana 10
The process must detect if the name exists in the file and if it exists put the value in the last place on the right that is not occupied by another value.
It's more complicated than I initially thought.
If you can think of any idea to achieve it, I will be very grateful.