Example Output file (output.txt)
4-0-4
4-0-4
4-0-4
4-0-5
4-1-18
4-1-18
4-1-18
4-1-18
4-1-18
.
.
.
.
What I'm doing
I'm opening a file which has been created in another executable, output.txt, and putting each line in array words[] to store the words.
I'm also opening another array count[] to count all the words in the file
now this is where I am stuck.
ultimately I want to get to the point where I can output a tally of all occurrences.
word qty
4-0-4 3
4-0-5 1
4-1-18 5
etc etc
any pointer would be great
Counting individual occurrences in a file
Counting individual occurrences in a file
AmigaOne X1000 - RadeonHD 7870, 4GB RAM - AmigaOS 4.1ß
AmigaOne X5000 - Radeon R7 250, 2GB RAM - AmigaOS 4.1ß
AmigaOne X5000 - Radeon R7 250, 2GB RAM - AmigaOS 4.1ß
-
- Posts: 475
- Joined: Fri May 15, 2015 5:15 pm
- Location: Waterville, Minnesota USA
Re: Counting individual occurrences in a file
To save lookup time use the words as the keys of the count table and ditch the arrays.
I'm on registered MorphOS using FlowStudio.