Parsing some log files

Nov 8, 2016 at 8:08pm
Hi All,

I have got some log files from a project and I need to parse some data from it and display.

Log Sample:
Line 11794:11/30/203500:26:00.994/69/29/abc/worker/ReadConfigParams/162/=Software Model Year = 2015

Line 11795: 11/30/2035 00:26:00.995/70/29/service/ProjectionWorker_1/ReadConfigParams/203/=Setting Model: XXXABC


Now,From the logs I need to extract Software Model year (ie 2015) and Setting Model (ie XXXABC)

How can these two details be extracted.
Thanks a lot in advance.
Last edited on Nov 8, 2016 at 8:20pm
Nov 8, 2016 at 8:26pm
Use getline (http://www.cplusplus.com/reference/string/string/getline/) to read in a line as a string.

Use find (http://www.cplusplus.com/reference/string/string/find/) to see if one of the appropriate "tags" is there ("Software Model Year = " or "Setting Model: ")

Using the result from find and the length of the "tag", use substr (http://www.cplusplus.com/reference/string/string/substr/) to extract the information you want.
Last edited on Nov 8, 2016 at 8:27pm
Nov 8, 2016 at 8:43pm
Thanks a lot.. Appreciate your help..
Topic archived. No new replies allowed.