Hi everyone. I am trying to figure out how to parse a log file in a specific way. What I want it to be able to do is to go line by line and count how many times a specific word appears per time stamp.
For example the log file is set up in this way:
[18:46:48] You attack
[18:46:48] You attack
[18:46:50] You attack
[18:46:52] You attack
[18:46:52] You attack
[18:46:54] You attack
[18:46:54] You attack
[18:46:56] You attack
[18:46:56] You attack
[18:46:56] You attack
[18:46:58] You attack
[18:46:58] You attack
[18:47:00] You attack
[18:47:01] You attack
[18:47:01] You attack
[18:47:01] You attack
[18:47:01] You attack
Now for example for the time stamp: [18:47:01] I want the code to look at how many times the word "attack" appears.
This would be 4 obviously.
Now for the time stamp: [18:46:56] The word "attack" appears 3 times.
Throughout the log file the word "attack" can appear 1, 2, 3, or 4 times per time stamp.
What I want the code to do is to count how many 1's, 2's, 3's, or 4's there are per time stamp in the entire file and to print out for example:
1's == 60
2's == 35
3's == 29
4's == 14
I am most familiar with c++ and currently taking a class in c++, so I would like to use this language. Is this possible to do in c++? And could you give me suggestions on how to do this? I don't want any completed code because I want to figure out the majority of this on my own. Thanks for the help!