BuildForge Help

.strsub

.strsub <source> <replacement> file [file ...]

Use the .strsub command to perform basic string replacement in one or more text files. The system scans the target file(s) for the <source> string; where a match is found, the system replaces the <source> string with the <replacement>. The .strsub command replaces every instance of the string (source) on each and every line in each file.

The .strsub command works across operating systems, without depending on any specific commands being available on the server.

To replace a string _VERSION_ in a file about.c, use a command
.strsub _VERSION_ 2.34 about.c
You must specify one or more filenames exactly, without using wildcards. For example, a command like the following will fail:
.strsub _VERSION_ 2.34 *.txt
However, you can use variables in the command, so a command like the following will work if the VERSION and FILENAME variables have been defined in the environment.
.strsub _VERSION_ ${VERSION} ${FILENAME}
Note: Use spaces to separate parameters in the command. Do not quote the parameters.
The .strsub command is similar to the .edit command; their differences include:
Related concepts
Embedding Build Numbers in Project Files
.edit