2012-08-01 20:57:32.547,ERROR,AuthenticateMethod/4, Response code=M2
2012-08-01 20:57:33.053,INFO,PaymentMethod/3,PAYMENT Response Code=0001


I have a file containing comma seperated text as above.
i need to parse this text and count how many times "AuthenticateMethod/4" and "PaymentMethod/3" these methiods are present in the file.

Can you please help me in this regard?


use strstr(Total_string, String_To_Find) function to find your requied string. This strstr() will returns a pointer to the first occurrence of String_To_Find in Total_string, or a null pointer if String_To_Find is not part of Total_string. with this strstr() you can find number of occurence of your string.