Edit text file
  • 08 May 2023
  • 1 Minute to read
  • Dark
    Light
  • PDF

Edit text file

  • Dark
    Light
  • PDF

Article Summary

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
TypeEdit text file
Name

Actions are easier to comprehend and manage over time when they have a suitable name that accurately expresses what they do.

FileThe path to the targeted file.
Actions tableHere 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
ContextThe level at which the action is executed, User or Device.
VariablesIf 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

Agent

It requires the Agent to be running.

Supported platforms

PlatformSupported
WebNo
WindowsYes
macOSYes

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.

* In the Basics panel, enter a name and description.
* Click Next. 
* In Script settings, click Upload and select a file. 
* Click Next. 

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:

* In Basics panel, enter a name and description.
* Click on the Next button.
* In Script settings, click Upload and select a file. 
* Click on the Next button.

Was this article helpful?