Re: search plain text files including wildcards

Tech-Archive recommends: Fix windows errors by optimizing your registry



On 9 apr, 16:04, "Larry Serflaten" <serfla...@xxxxxxxxxxxxxx> wrote:
"Co" <vonclausow...@xxxxxxxxx> wrote

The problem is that I have to search according to a list of names.
So I take the first word and search for that in the file, then I take
the second word and search for that.

That is not a problem, see the /g switch for the FindStr command.

I'd rather keep it inside VB.

Well, If you limit your search to VB code, then you'll have to
type that code in....

The fast way would be to use InStr, but InStr doesn't support
wildcards.  The Like command does, so that seems to be your
only VB option....

LFS

Larry,

If I'd use the FindStr command.
How could I call it from VB?
Could you give me an example to work on?

I store all the txt files in one folder.
However since I have to give back the exact file where a word was
found
I need to search file by file.
Something like:

Open txtfile 1
Do While rst.EOF = False
If FindStr ......... rst.Fields("word") = True Then
.... write it to the table that holds the filenames
Endif
rst.Movenext
Loop
Close txtfile 1

Regards
Marco



.