Search for (and replace) text within files

I found a couple of useful little pieces of freeware software this week that allow you to search for a line of text in files and replace it with another (or a blank space to remove it). I wanted to be able to modify our many .bat login scripts at work, all at once. There is no way that I saw (at least with our setup) to do this with stock Windows XP or 2003 boxes so I hit up the Google piece.

grepWin

This tool seems to be geared more towards programmers as it only allows you to replace expressions within a developed program. Not fully sure why it works this way, but you can switch it to text search (only) mode.

I use this one to simply find files that contain a certain string of text. It adds a option to the right-click context menu of Windows, so right click on a folder and bring the program up to search. It’ll list the files within that folder that contain that string of text you enter and you can even open/edit them or copy/cut/delete them right from the list.  Download here

TexRep 2.0

This utility is far better for my purposes. You basically open up this light weight program and choose a folder to search, below the folders you’ll get the list of files in that folder to choose from (or click the select all button). Then on the right hand side you can type text to look for and replace with. It has a small results box that tells you which files were modified and how many instances within that file were changed. It even has an option to create automatic backup copies for each file modified.

This one does the legwork, but I’m not sure if it can just search for the text without replacing it and it has no context menu option so you have to browse to the folder you wish to scan each time you open the program. This is why it works well together with the first program if you need to identify the files first.

I was basically using TexRep to scan the scripts folder under the sysvol directory on a domain controller to search and replace (or remove) lines from our some 180 login script batch files on the quick. Very handy. Download here

So if you need to do some tedious editing of many txt/bat/vbs (or similar files) grab up these free and light weight utilities right now. They sure as hell made my job much easier with all the login script editing I had to do this week.

-Dave out

Advertisements

One thought on “Search for (and replace) text within files

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s