gsar (General Search and Replace)

gsar (General Search and Replace) End of life

Utility for searching for and optionally replacing strings in both text and binary files. The search and replace strings can contain all kinds of characters (0--255), i.e. CTRL characters and extended ASCII as well.

Category
File System
License
GNU
Platforms
Windows
Released
2008
Path
c:\gsar\gsar.exe
Benefits
Gsar can search one or several files for a string and report the occurrences. Gsar can read one file, search for a string, replace it with some other string, and create a new file containing the changes. Gsar can perform a search and replace in multiple files, overwriting the originals. Finally, gsar can work as a filter, reading from standard input and writing to standard output.
Notes
No mutli-line or regex support. (All files and strings are treated as binary.) The algorithm used is a variation of the Boyer-Moore search algorithm, modified to search binary files. As a result of this, gsar is blindingly fast.
Version
Latest known: 1.21 (2008-01-30)

Examples

1. Replace all instances of case-insensitive "cold fusion" with "ColdFusion".

gsar.exe -o -i -s"cold fusion" -r"ColdFusion" *.cfm

2. Replace text in multiple files and replace the text.

gsar.exe -s__ZTC__ -r__TURBOC__ -o foo.cfm bar.cfm bat.cfm

3. Searches for "createdate" and only creates a new file with the text replacement to rename as "datecreated"

gsar.exe test.json test_result.json -f -screatedate -rdatecreated

Try it

Agree to terms to run demos.