IronBits
06-23-2007, 01:35 AM
finder.vbs "Text to Find" "Filename to look in.txt" or .xml but still TEXT.
Open File {
read one line at a time and look for "Text to Find"
If found - stop reading file ; exit (1)
}
else
{ exit (0) }
Close file
If the String is there, stop reading the file and give me a %errorlevel% 1, else %errorlevel% 0 is good if not found. ;)
Filename could be on a local HDD or "\\Servername\Sharename\Folder\Folder\Filename to look in.txt" (under 255 chars)
"String to find" and "PATH" will be inside double quotes (a given)
If file doesn't exist - exit 0 is fine - if you want to print Found String, that's fine, but I'm only looking for the EL.
If no command line params are provided, print Example: finder.vbs "string to find" "filename to read.txt" ;)
I can do this in Perl, but need something to run in a DOS/Windows batchfile.
Find and Findstr read through the whole file before returning which slows down the whole process as sometimes the files are several megs and over very slow network connections. :(
TIA! :)
Open File {
read one line at a time and look for "Text to Find"
If found - stop reading file ; exit (1)
}
else
{ exit (0) }
Close file
If the String is there, stop reading the file and give me a %errorlevel% 1, else %errorlevel% 0 is good if not found. ;)
Filename could be on a local HDD or "\\Servername\Sharename\Folder\Folder\Filename to look in.txt" (under 255 chars)
"String to find" and "PATH" will be inside double quotes (a given)
If file doesn't exist - exit 0 is fine - if you want to print Found String, that's fine, but I'm only looking for the EL.
If no command line params are provided, print Example: finder.vbs "string to find" "filename to read.txt" ;)
I can do this in Perl, but need something to run in a DOS/Windows batchfile.
Find and Findstr read through the whole file before returning which slows down the whole process as sometimes the files are several megs and over very slow network connections. :(
TIA! :)