File Replace String activity

  • Release version: Xanadu
  • Updated August 1, 2024
  • 1 minute to read
  • 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, which gives workflow administrators the ability to store input and output variables in the databus.

    Input variables

    Table 1. File Replace String 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

    Table 2. File Replace String 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

    Table 3. File Replace String 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.