Searching for strings/values/entries in text files

Hi.
I have an assignment to where I have an existing text file and I need to pull information specifically out of it. A few lines of this file would be:
score sex sch score
Doug M CC 89
You F UN 78
Me F CC 83

And so on. The object is to pull the score from each male, add it up and get the average. Then do the same for females, then for CC, and for UN. I've looked through tutorials, and my book I have, and am having a hard time finding out how to retrieve that information.

I'm not sure how I would have the program search for each line that has an 'M' in it, then pull the score from that line. Once this is done, it would do the other categories as well of course for 'F', then for all 'UN' and then 'CC'.

I don't have code that I can provide for this right now, I'm really just looking for some sort of direction because I'm pretty much lost at the moment and really frustrated with something that can be so simply (I just don't know how yet)
Thank you...
I'm really just looking for some sort of direction


1) Open File
2) Read file
3) Close file
4) Do Calculations
5) Display output
6) Pat yourself on the back
Topic archived. No new replies allowed.