Find/Replace Text Script

Search script and replace a character string in a file or all files in a directory filtered by mask. The script is recursive and can search or replace all subdirectories.

It is a command line program with a binary executable application and PHP, as well as source code in Script and C++.

Use

You can execute a binary program or PHP script with the commands:

search options
php search.php options

Search for text

To find a string of characters in the contents of a file, navigate to the folder where the file is located.

To search a single file:

search texte fichier

In all catalog files, issue a mask, for example * .html

search texte *.html

And to enable subdirectories:

search -r texte *.html

Other options:

-i ignorer les majuscules
-c rechercher un identifieur dans du code source. 
-v afficher tous les fichiers analysés.
-q ne rien afficher.

Replace Character String

The rules and options are the same, but there is an additional parameter, this is the text that replaces the found text. Only the presence of this parameter controls the replacement:

search -r texteoriginel nouveautexte *.html

Loading

Changes in versions