The Edit text file action allows you to search for a string inside a text file and replace that string or line with different data.
General | |
---|---|
Type | Edit text file |
Name | Actions are easier to comprehend and manage over time when they have a suitable name that accurately expresses what they do. |
File | The path to the targeted file. |
Actions table | Here you can replace one or multiple strings or lines inside the text file. In case of the Replace line action, you can insert only a part of the string, and it will replace the lines that match it. |
Advanced | |
---|---|
Context | The level at which the action is executed, User or Device. |
Variables | If this option is selected, then variables are supported within the action. |
Filters |
---|
Here you can define conditions which determine if the action will be executed. For more information, see Filters. |
Agent
It requires the Agent to be running.
Supported platforms
Platform | Supported |
---|---|
Web | No |
Windows | Yes |
macOS | Yes |
Example
In the text file below, we will replace all the lines that contain the word 'Next' with the 'Click on the Next button.' string.
When you create the Edit text file action, in the General tab, click Create; in the Add action dialog box that opens, add the following parameters:
Name Replace lines with 'Next'
Search string Next
Select the Case sensitive checkbox
Occurrence All occurrences
Action Replace line
Value * Click on the Next button.
The result is: