PDA

View Full Version : BigSearch - search within multiple binary files


Stiebler
08-09-09, 02:05 PM
Have you ever wanted to locate all occurrences of a text string in hundreds of files including binary files? Because you’ve forgotten where you last altered the parameters, and you need to find them again in order to alter them again?

It is not so easy. Any text searcher (including those provided by Microsoft) will locate your text in text files, but not in binary files (nor pdf, html, etc). Equally, any hex editor will enable you to find all occurrences of a text string in a single binary file, but not across hundreds.

Recently, I needed to find all occurrences of ‘Bold’ (all combinations of upper and lower case) across the 24,000 or so files of Silent Hunter III/NYGM. So I wrote a short C++ program to do this.

The program is called BigSearch, and you can download it from my signature below.

It works for searches of binary files and for searches of text files too, so it doubles as a simple finder of texts in ordinary text files. You can also carry out AND, NOT and OR operations, and exclude file types of no interest (such as music or sound files) A short pdf instruction manual is included - please read it first (only 3 pages).

I like all my programs to run very, VERY fast, so BigSearch does too! Pity about the archaic interface, though.

I’ve given BigSearch a good bashing for my own use, and verified its accuracy in locating search items. But doubtless some of you guys out there can find bugs in it. Use at your own risk!

Stiebler.

Laufen zum Ziel
08-09-09, 03:02 PM
Thank you. I will give it a try.

Krabb
08-10-09, 10:46 AM
Interesting program. Thanks!

But Microsoft actually has such text searcher in the command line ;):
findstr /s /i /m "string" *This will search for "string" (case-insensitive) in all files from the current folder and all subfolders and will print the filenames of files containing a match. See program's help ("findstr /?"). It can even use regular expressions for search.

Stiebler
08-11-09, 04:13 AM
But Microsoft actually has such text searcher in the command line ;):
Code:
findstr /s /i /m "string" *
Now he tells me! I wish I had known that earlier, it would have saved a lot of work. (Don't forget to add ' >> results.txt' - without the quotes - to the findstr line shown above, to save the results obtained.)

However...
Since I *have* now completed my alternative, which is simpler to use (Windows interface), allows extra options and runs faster, I might as well leave 'BigSearch' publicly available to those who want it.

Out of curiosity, I checked the output from the Microsoft version on the SH3/NYGM combination. Both gave identical file hits (allowing for the fact that the Microsoft version has no option to disable the searching of unnecessary tga files), so well done Microsoft!

Stiebler.