We're a community of 1076K IT Pros here for help, advice, solutions, professional growth and fun. Join us!
1,075,970 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Start New Discussion Reply to this Discussion

Counting the occurrence of a pattern in a comma seperated file.

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

Hi,

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?

Regards,

2
Contributors
1
Reply
3 Hours
Discussion Span
9 Months Ago
Last Updated
2
Views
RReddy1
Newbie Poster
2 posts since Jul 2012
Reputation Points: 0
Solved Threads: 0
Skill Endorsements: 0

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.

Perry31
Junior Poster in Training
90 posts since Oct 2010
Reputation Points: 4
Solved Threads: 7
Skill Endorsements: 0

This article has been dead for over three months: Start a new discussion instead

Post: Markdown Syntax: Formatting Help
 
You
 
© 2013 DaniWeb® LLC
Page rendered in 0.0578 seconds using 2.66MB