Simple talk and how to's for those Gizmos, Gagets and More
 

Need your own website?


Custom Search

 

Need to find some words?  Grep for Windows!

By Lee Brannon

 

Unix, Linux and Macintosh users all enjoy the availability of a search tool that is lacking in Microsoft Windows. A wonderful command line utility called Grep is taken for granted by those users.

Grep has it’s origins in Unix and as I mentioned it is a command line utility that does a great job of searching for text strings in files.  Basically you type the word grep followed by any text or text string you want to search for and grep returns a list of every file containing that string.  Sample:

Grep banana

This would return a list of every file containing the word banana.

Over the years many variations of this command have emerged and features such as listing the line numbers and or displaying the line of a file that contained the text string have been added. Now there are options in many of the GUI based variants that allow you to do a search and replace.  This lets you search every file on a disk or in a folder for the text string and replace it.

Now my earlier example is not very “real world” but if you think about it there are many instances where this replace ability would come in handy.  Have you ever moved?  Did you need to change your address in a lot of documents?  Have you ever noticed a typo in a web page heading that is on every page? (This was my immediate need.)  Another great use for this tool is the ability to find something you wrote when you have forgotten the file name.  Just enter a word or phrase that you remember from the file and let the Grep program list every file it is in.

Many of us, jealous of this simple tool, have sought out equivalent programs for our Windows based computers.  The search in Windows has never been all that useful and compared to many of these grep and “grep like” programs it is intolerably slow.  Not to mention the fact that it only list the file names and not where it found what you were looking for in the file.  These grep programs usually list the line number and display the lines that it found so you can quickly confirm that the file is the one you are looking for.

The other day I again found myself looking for a way to make the same changes to multiple files and I once again started searching for a good grep program. I found several right off that bat that were listed commercially.  Unfortunately many of these were listed at a cost of as much as $149.00

Determined to meet my immediate need and to look for a grep like program to use in the future I began looking deeper for programs that were either free or low cost. In searching for working samples I wasted a lot of time downloading trial versions from websites only to find out that the trial was handicapped in one way or another. I don’t mind trial versions that expire, but disabling the most useful features really does not give a person a chance to “really” try the software out.  Realizing that my abilities to locate usable software on the net are better than average I determined that many people must be having an even worse time locating a decent grep or grep like program with search and replace capabilities.

I found two that were “real” trials, had the replace capability that I needed and the purchase price after the trial expired was reasonable.  I am linking them here for you to check out if you like.

The first one is Windows Grep by Huw Millington

www.wingrep.com

 

The second program is AJC Grep offered by AJC Software

.www.ajcsoft.com

 

Both programs do a good job, are fast and offer features like not modifying the original file.  They differed mostly in style.  The WindowsGrep program presented you with easy to follow dialogue boxes asking you questions for each step of the process.  The AJCGrep program opens with an easy to follow screen containing most of the options for doing a search and or replace.

 

Shown here are the opening screens from both programs with a search setup in progress:

AJC Grep

 

 

Windows Grep

 

I have “played” with both programs and tested for all the criteria I was looking for.

One experiment I conducted with both.

I had a typo in the heading of several web documents so I tested the search and replace against the entire directory. I had each program search for GIZIZMO and replace the instances with Gizmo.  The search in each program returned a list of 77 to 99 files out of 526 files searched. (Both programs had options for searching text or binary files so the number of matches differed according to the settings I specified.)

 

Shown here are both programs after a search:

AJC Search results  

 

 

Windows Grep results

Both programs made the replace in a matter of a few seconds and both programs had an option to write the changes to the original files or to a new file.  In the case of Windows Grep, the program wrote the changes to duplicate files with a .new extension added to the end. The AJC Grep program had an option for saving the original with a .bak extention.

Both programs offered several additional features such as saving the search criteria for later use and printing out the results of a search or saving it to a file. 

 Another reason you should probably look at these two programs is that both had decent help files and I used the contact information posted on both websites and got responses almost immediately. 

Well there you have it.  Check them out and happy greping!

 

Product screen shot(s) of Windows Grep reprinted  with permission from Huw Millington

Product screen shot(s) of AJC Grep reprinted  with permission from AJC Software

Microsoft product screen shot(s) reprinted with permission from Microsoft Corporation.

 

A text version of this article has been distributed to Articlesbase.com

 © 2009 Lee Brannon All rights reserved.

Always seek professional help: The tips presented on these pages are meant as a guide to help you get answers to your questions or to point you in the rightdirection. The website author recommends that anyone who is not comfortable with the technology being discussed contact a professional for assistance. Recommendations and reviews are based on the authors own experience with a process or product.  Your results may differ. The website author is not responsible for problems, loss of data or other complications derived from the use of the information presented on this site.   Terms of Use and Disclaimer.