BigCalm : Visual Basic : Grep For Windows

WinGrep 1.3



Download Source Code


For all those UNIX people out there, "grep" should need little introduction. It is simply a powerful tool for extracting lines from files. This is the GUI version for Windows.

To those of you who don't know UNIX, "grep" looks for lines matching a regular expression in a file, and if it finds a matching line, then it outputs it to a new file. For an explanation of "regular expressions " please examine the VB help on the " Like " operator."

For example if I have a file containing the lines:

good Morning
and how
are
you?
good Afternoon
and Goodbye!


..And put the following regular expression into WinGrep and run it:
"Good"

..then the following lines will be added into the output file:

good Morning
good Afternoon
and Goodbye!



Up to 10 Regular expressions may be specified in WinGrep by putting semicolons between the Regular expressions. For example, if I was looking for either the words "Good" or "you" then my regular expression would be: "Good;you" and my output would be:

good Morning
you?
good Afternoon
and Goodbye!


Characters in pattern Matches in string:

I know this help file is short - if you need any more information you can contact me at bigcalm@hotmail.com

Bug fixes, Improvements, and Suggestions are most welcome too.



New functionality for Version 1.1
  1. Pre-Post line extraction
  2. Counting facility
  3. Find-Files is now finished.
  4. Numerous minor bug-fixes.

New functionality for Version 1.2
  1. UNIX Command Line style text box for those moving to WinGrep from Unix or Dos Grep
  2. Load and Save searches
  3. "HOT" (quick search) buttons for those regular searches (registry keys)
  4. Improved file finding dialog on main form.
  5. DisplayFilenames option changed + Seperator included.
  6. Can be run from the command line and explorer. i.e. It processes it's arguments, and now runs using a Sub Main() procedure.
  7. Post-extraction works correctly now.
  8. I've put some comments into the Grep functions, 'cos they were getting horribly complex.
  9. Silent modes for command line running
  10. Example files included.

New functionality for Version 1.3 (bug fixes mainly).
  1. If JustCountThem And DisplayFileNames = OncePerFile then don't have any output if matches = 0 for that file
  2. More than 10 regular expressions! I thought 10 was easily enough, but no.
  3. Improved modularity using compiler directives.
  4. Removed disgusting common dialog and listview hacks (and replaced with ones almost as bad, sigh).
  5. Numerous bugs in WorkOutGrepCommand() and PropagateUp() fixed.
  6. Move to using Windows temp directory for default output files, and add cleardown routine.
  7. Multiple concurrent searches (in different applications).
  8. Automatic registration of script files for use with explorer.

Further improvements that people have asked for....
  1. Awk! (They don't ask for this directly, but practically, an Awk scripting language is what they need). - They can bog off unless they offer me a fat cheque or some seriously good parsing code or source code for a compiler (not fussy which language, excepting Prolog and LISP).


29th September 2001 Copyright Jonathan Daniel 2001