i try to make a VBScript that read a txt and search for two strings and gives out only the last results.
String 1: Hello123
String 2: Test123
The TXT looks like this:
27.07.2010 09:45 ... DumDumDum ...
27.07.2010 09:45 ... BlaBlaBla ...
27.07.2010 09:45 ... Hello123 ...
27.07.2010 09:45 ... BlaBlaBla ...
27.07.2010 09:45 ... DumDumDum ...
27.07.2010 09:45 ... DumDumDum ...
27.07.2010 09:45 ... Hello123 ... 'This Result
27.07.2010 09:45 ... BlaBlaBla ...
27.07.2010 09:45 ... BlaBlaBla ...
27.07.2010 09:45 ... DumDumDum ...
27.07.2010 09:45 ... Test123 ...
27.07.2010 09:45 ... DumDumDum ...
27.07.2010 09:45 ... Test123 ... 'And this Result
27.07.2010 09:45 ... DumDumDum ...
27.07.2010 09:45 ... BlaBlaBla ...
I try something like this, but i don’t know how to do this:
Read the txt with ReadALL i think and than the search part.
if string 1 not found then
msgbox "nothing found"
Goto NEXT
else
if string 2 not found then
msgbox "nothing found"
else
msgbox "found"
End if
End if
NEXT
Has someone an idea and can help me?
Greetings,
matthias
if its not part of a bigger vbscript program and you have the luxury to download stuff, you can use a file processing tool, such as gawk for windows eg one liner
With vbscript, use instr() to check for each string “Hallo123” and “Test123”, then if found, assign a variable to that line. At the end of file iteration, print out those 2 variables.
example searching for “Hallo”