gr1fter Posted July 27, 2011 Posted July 27, 2011 Hello. I have a log file: Example of text file THERE ARE LOTS OF VALUES IN THIS TEXT FILE BUT I ONLY WANT TO RETRIEVE WHAT IS IN BETWEEN THE EXIT CODE VALUES <ExitCode>14566</ExitCode> I would like to search that log file and only get what is between the <ExitCode>??????</ExitCode> markers. Can you help me with this please, I have an example and I can find the position in number format, but I dont know where to go from there to get the actual value. Do i want to string left from there?? $file = FileRead("C:\test.log") $result = StringInStr($file, "</ExitCode>") if $result then MsgBox(0, "Found it", "Found it at character position: " & $result) Else MsgBox(0, 'Not Found', "String Not Found") EndIf Thanks,
smartee Posted July 27, 2011 Posted July 27, 2011 Look in the help-file for _StringBetween(), StringRegExp()
gr1fter Posted July 27, 2011 Author Posted July 27, 2011 Look in the help-file for _StringBetween(), StringRegExp() Sweeet! Did not see that one. This is what I did and it worked perfectly #Include <String.au3> $file = FileRead("C:\test.log") $aArray1 = _StringBetween($file, "<ExitCode>","</ExitCode>",-1) MsgBox(48,"",$aArray1[0])
gr1fter Posted July 27, 2011 Author Posted July 27, 2011 Look in the help-file for _StringBetween(), StringRegExp() Thanks for your help
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now