Navigation:  Actions > Files >

Replace in File Action

Previous pageReturn to chapter overviewNext page

This action creates a step to find and replace text in a text or binary file.  It can be used with the Process Files action to replace text in multiple files.


When built, the action reads the input file into memory, performs the find and replace operation, and writes the updated contents with any replacements to the output file.  If no matches are found and the append field is not empty, the text from the append field is appended to the file.  Otherwise, if no matches are found or the replacements would not change the file contents (the file already matches the replacement text) and the input and output filenames are the same, the existing file is not modified.


When the step completes, the following temporary macros are created or updated:

REPLACEINFILE_MATCH_COUNT = The number of matches found in the file
REPLACEINFILE_REPLACE_COUNT = The number of replacements made in the file


Replace tab


Text tab


Note: See the Files.bld sample for a project utilizing this action.