By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
437,807 Members | 1,995 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 437,807 IT Pros & Developers. It's quick & easy.

parsing text file

P: 73
Hello,

I stored a text file into an array. Now I am going through the array looking for a particular string. When I find that string, I want certain things that come after it to be stored into a variable until I reach a flag which tells me that I am done. I would like to repeat this for the entire file.

So this is what I have so far:

Expand|Select|Wrap|Line Numbers
  1. foreach $line (@raw_messages)
  2. {
  3.     if ($line =~ /ca69/) # looking for 'ca69' in the message 
  4.     {    
  5.         do {    
  6.              $e_message = $e_message . $line;
  7.         } while ($line =~ / };/);  # flag
  8.     }
  9. print PARSED_MESSAGE_FILE $e_message, "\n";        
  10. $e_message = "";
  11. }
  12.  
This works for the first line that contains "ca69". However, it doesnt keep going to the next line until it finds " };".

Can anyone help?
-Thanks.
Nov 9 '09 #1
Share this Question
Share on Google+
2 Replies


P: 73
This problem has been resolved. Please remove the thread.
Nov 10 '09 #2

numberwhun
Expert Mod 2.5K+
P: 3,503
Thank you for letting us know. Much appreciated.

Regards,

Jeff
Nov 12 '09 #3

Post your reply

Sign in to post your reply or Sign up for a free account.