i have a log file with several entries like the following one:
INFO [26.04.2017 11:37:48] [main] XML-Data: <online-activation> <general> <userid>XYZ</userid> <mac-address/> <OU>VG-DE</OU> <ROLE>KDT</ROLE> <FOA>PRO;FC;DOM;MDD</FOA> <BRD>XYZ;IMP</BRD> </general> <applications> <app expiration-date="2017-10-01" name="BB-INFO"/> <app expiration-date="2017-10-01" name="MMSKD"/> <app expiration-date="2017-10-01" name="FM-TOOL"/> <app expiration-date="2017-04-05" name="WEB-BTD"/> <app expiration-date="2017-10-01" name="OFFLINE-BTD"/> <app expiration-date="2017-10-01" name="MDU-UPD"/> <app expiration-date="2017-10-01" name="MDU"/> <app expiration-date="2017-04-05" name="WEB-WDA"/> <app expiration-date="2017-04-05" name="WEB-ETD"/> <app expiration-date="2017-10-01" name="OFFLINE-WDA"/> <app expiration-date="2017-10-01" name="OFFLINE-ETD"/> </applications> </online-activation>
I need to collect all the XML-Data, my search doesn't work:
Func FileSearch() $j=0 For $i = 0 To UBound($content_array) - 1 $search_result=StringInStr($content_array[$i],$search) If $search_result<>0 Then ReDim $searchResultArray[UBound($searchResultArray) + 1] $searchResultArray [$j] = $content_array[$i] _ArrayDisplay($searchResultArray) $j+=1 EndIf Next EndFunc If i search for "online-activation", it retrieves only the first and the last tag, but not what is within.
In addition, when i use FileReadToArray, all the entries between <online-activation> and </online-activation>
I have a good handle on how to read a file line by line, and search for a given string.
Basically using, FileOpen, FileReadLine, and StringInStr.
I have been trying to figure out why my search keeps coming back with no match.
For example, if my string line was "Where is Waldy", and I was searching for Waldy that comes back fine.
But in my file, Let's say it is
Where is "Waldy"
So i read that line in and do a search for Waldy, but i comes back with no match since there is quotes around it.
Is there a way to resolve this?
Here is my actual example
The line comes back like this
I'm searching for LineDisp_iSC480, but its coming back with no match due to the quotes.
Thanks in advance, James
Hello, I want to be able to search for multiple strings and if any of the strings are found I want it returned which one it is. I've been able to search for multiple strings using the OR command, but I'm not sure how I am supposed to make it return which of my strings is found. I've given an example below
If StringInStr($html, Batman) OR StringInStr($html, Superman) Then MsgBox(0, "Success", "The string found was: Superman") EndIf So it will search for the two strings and whichever it founds it will return me with. How can I make that work?
#include <Array.au3> #include <File.au3> #include <MsgBoxConstants.au3> Local $path="C:\Users\rootx\Desktop\Nuova cartella",$mask = "*.jpg;*.png;*.ico",$Pos $FileArr = _FileListToArrayRec($path,$mask,1,1,1,2) For $x = 1 to UBound($FileArr)-1 If $Pos = StringInStr($FileArr[$x],"-") Then ConsoleWrite("------"&$FileArr[$x]&@CRLF) Else ConsoleWrite($FileArr[$x]&@CRLF) FileDelete($FileArr[$x]) EndIf ConsoleWrite($x&@CRLF) Next ConsoleWrite($x-1&@CRLF) I would write a loop that individuals and delete files that contain this feature....
File name-150x100.jpg, or other -SizexSize
But in this case how can I filter properly?
File name 150x100-150x100.jpg
File name -100-150x100.jpg
I love Autoit, but struggling to find the best way to do this.
I have 2 text files.... File1 is Tab Separated and File2 is CSV. I am attempting to read in a line from File1 and split it, then search the contents of File2 for one of the substrings from that split line. If I find a match, then I want to split the matching line and grab needed info from it to complete the record and output the combined record to a file.
Example line from File1:
17 123456789 learned 10800 bridging 1/13
Example line from File2:
172.25.17.103,computername.domain,Reservation (active),DHCP,123456789,,Full Access,N/A
From File1, I grab the 2nd column (MAC Address) and search for that in the 2nd file (Column5)
I really thought reading file into an array and doing an _arraysearch was the way to go, but that seems to require searching for the whole string, not a sub-string.
What I have been trying to do so far is read in file1 one line at a time, split the string, then read in file 2 one line at a time and check for a matching substring..... handle that. Then back to file 1 to repeat the process. This seems so clunky.
So I would love suggestions on what functions might work best.
Thanks so much for any feedback.