Answer the question
In order to leave comments, you need to log in
How to process a text file in C ++, find certain lines in it with a certain word and output it to another file?
There is a text file chatlog.txt. Check the first word in the first line between "}" and "[". Example: "}Kazer_Scrazer[" Then search the file for the same word between characters. If it finds - output all lines containing this word to the text file warninglist.txt, delete them from chatlog.txt. If it doesn't find it, it deletes it from chatlog.txt.
Then it takes the second line, does the same, and so on until there is no text left in the file.
(Optional) If possible, check if the interval in messages after processing is greater than 5 minutes - delete lines. (The time is indicated on the left in square brackets in the format [hours:minutes:seconds])
Ps I do not ask you to do all the code, although it is desirable. Please suggest libraries and an example of string processing
An example of lines in the chatlog.txt file (ps on the site auto-line break, it is not in the file and any line starts with "["):
[15:40:20] {6495ED}[VIP] {FFFFFF}Satoshi_Nakamoto[649]: Sell Maverick TT 43kk ===> Call 9222599
[15:40:26] {6495ED}[VIP] {FFFFFF}Yuki_Nakajima[717]: In fact, if the discount is 50#, does it mean a shift too?
[15:40:44] {6495ED}[VIP] {FFFFFF}Josue_Montano[54]: Selling enforcer tt call
[15:40:45] {6495ED}[VIP] {FFFFFF}Yuki_Nakajima[717]: In fact, if discounts 50#, means to change too?
[15:40:46] {6495ED}[VIP] {FFFFFF}Cameron_Dream[646]: How much does the stall cost a dollar
[15:41:25] {6495ED}[VIP] {FFFFFF}Satoshi_Nakamoto[649]: Selling Maverick TT 43kk ===> Call 9222599
Example after processing in the warninglist.txt file:
[15:40:20] {6495ED}[VIP] {FFFFFF}Satoshi_Nakamoto[649]: Selling Maverick TT 43kk ===> Call 9222599
[15:41:25] {6495ED}[VIP] {FFFFFF}Satoshi_Nakamoto[649 ]: Selling Maverick TT 43kk ===> Call 9222599
[15:40:26] {6495ED}[VIP] {FFFFFF}Yuki_Nakajima[717]: In fact, if the discount is 50#, does it mean a shift too?
[15:40:45] {6495ED} [VIP] {FFFFFF} Yuki_Nakajima [717]: In fact, if the discounts are 50#, does it mean a shift too?
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question