--- title: File Replace String activity description: The File Replace String activity finds and replaces a string in a file on a Linux or UNIX computer. locale: en-US canonical_url: https://www.servicenow.com/docs/r/australia/servicenow-platform/orchestration/r\_FileReplaceStringActivity.html release: australia product: Orchestration classification: orchestration topic_type: reference last_updated: "2026-03-12" reading_time_minutes: 1 breadcrumb: [SSH activity pack, Orchestration activity packs, Classic Orchestration, ServiceNow AI Platform Additional Capabilities, Extend ServiceNow AI Platform capabilities] --- # File Replace String activity The File Replace String activity finds and replaces a string in a file on a Linux or UNIX computer. This activity replaces an SSH activity by the same name available in releases prior to Istanbul. If you have a workflow created in a previous version that uses the deprecated activity, your workflow will continue to work normally after upgrading to Istanbul. However, all new workflows must use the custom version of this activity. This activity was built with the [SSH activity template](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/servicenow-platform/orchestration/t_CreateAnSSHActivity.md), which gives workflow administrators the ability to store input and output variables in the [databus](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/servicenow-platform/orchestration/c_OrchestrationDatabus.md). ## Input variables
Variable Description
hostname Hostname or IP address of destination server for SSH activity.
directory Name of the working \(target\) directory.
file Name of the file in which the string is to be replaced.
find\_pattern A regular expression of the text to replace.
replace\_string The replacement string for the text found by the expression in the **find\_pattern** variable.
options Replacement options:- **first**: Replaces the first occurence of the pattern. - **all**: Replaces all occurrences of the pattern.
## Output variables |Variable|Description| |--------|-----------| |return\_code|Indicates whether or not the string was replaced successfully in the target file.| |error\_message|Message that indicates if an error has occurred. Any value other than **0** indicates a failure.| ## Conditions |Condition|Description| |---------|-----------| |Success|The activity has successfully replaced the string in the file.| |Failure|The activity has failed to replaced the string in the file.| **Parent Topic:**[SSH activity pack](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/servicenow-platform/orchestration/c_OrchestrationSSHCustomActivities.md)