Archive: Search in file for 5 possibilities


Search in file for 5 possibilities
I need some help!

I have to search for a textstring in a file. The problem is, that the string might be one of five but unique. If one of these five is found, it has to be given back.

the five strings I am looking for are: mysqld.exe, mysqld-nt.exe, mysqld-opt.exe, mysqld-max.exe and mysqld-max-nt.exe

Any ideas?
Chris


Can I use wildcard chars in a string search? Something like '*' or '?' would already help.


If you are searching for text string in(side) a text file (not in a file name), the only way I know for all Windows platforms is to read file in a text mode and use StrStr (B.4 Search in a string) or direct strstr() system call. '*' or '?' are not supported.
W2K/XP also correctly support 'grep', so you can use one of common 'cat' /UNIX/ filters. Run 'cat' with 'grep' using nsExec and parse output string.

If you search for some text in a file name with FindFirst/Next/Close, you can use '*' or '?', but please note - complex expressions may not work on Win9x.


Sorry, only more.com in Win distribution. cat is a part of UNIX services for Windows.