dbattaglia
11 years agoContributor
What is the most efficient way to retrieve values from a text file?
I have a CSV text file from which I need to retrieve values in a particular column.
Many of the key/id values will be repeated, and for each record having a matching key/id I will need to store a related value in a different column.
For example:
id,description,amount,date
12345,yellow crayon,1.25,5/25/2015
3412,green crayon,1.05,5/5/2015
12345,orange crayon,.75,5/10/2015
92355,blue crayon,2.75,5/13/2015
3412,yellow crayon,1.02,5/7/2015
Suppose I need to find the sum of amount column for id 12345.
I can think of a couple ways to try this, but am wondering if anyone can advise regarding the most efficient way to read the file and retrieve the values.
Thanks in advance!