Frint - Find & Replace In Text files
Frint
An open source GPL program to Find and Replace IN Text files.(last updated: December 6, 2004 13:08)
Frint is a simple Win32 program that will search text files for a specific string, and replace that text with another string. It doesn't do regular expressions, and it doesn't have a GUI, but it does what its supposed to do. Quick and Easy.
It was written out of frustration with gawk which for the life of me I couldn't get to replace a string like $\FooProject with a string like $\BarProject because it kept wanting to do something with the '$' and '\' as regular expressions. Eff all that. If you need a program that will search an entire directory structure for files matching a simple wildcard, and replace one string with another, and thats it!, then Frint is for you.
The current version is 1.0. You can get the Visual Studio.NET source here, or the binary executable here.
If you use it, and find it useful, please email me and boost my ego a bit. If you use it, and think it sucks, I'd be grateful for some constructive criticism, too.
Installation
Installation is easy.
1. Download or copy the binary file (frint.exe) to your Windows System directory. If you don't know what that is or don't know how to find it, you probably don't have a use for Frint.
Thats it.
Some Example Scenarios
| C:\>
FRINT *.html . "Old Company Name" "New Company Name" /s |
The above command will examine each .html file on your C drive for the string Old Company Name. Each one that it finds will be replaced with New Company Name. If, for example, it found a string like OLD COMPANY NAME or OLD Company Name, these would not be considered matches and would remain untouched.
| C:\>
FRINT index.html . OldProductName NewProductName /s /ci |
The above command will search each directory on your C drive for an index.html file. When found, it will replace each instance of the string OldProductName with NewProductName. Strings like OLDPRODUCTNAME and OLDproductNAME would also be replaced with NewProductName.
| C:\SRC>
FRINT *.sln . $/OldProjectName $/NewProjectName /ci /s /l2 |
The above example will search the C:\SRC directory and all its children for Visual Studio .NET solution files. It will replace each instance of $/OldProjectName with $/NewProjectName, regardless of the case. It will also print a report saying which files it touched, and how many instances of $/OldProjectName were replaced.
Known Issues
1. If you have a file that has any single line that is longer than 2048 bytes (2 K), the program will hang when it tries to read it. You can recompile the code to assign a larger buffer, however. Simply find the line (#228 at press time) that reads
int buffSize =
2048;
and change it to whatever size you need it to be.
