Hitachi

JP1 Version 12 JP1/Automatic Operation Service Template Reference


4.13.43 Replace character string

Function

In a Windows or UNIX environment, all occurrences of a specific character string in the specified file are replaced with the specified replacement string.

The file is overwritten with the replacement results.

If there are no occurrences of the string to be replaced, the file is not updated.

The following describes the server that this plug-in requires:

- Execution target server

The server on which this plug-in is executed.

Notes on specifying the common.replaceTarget property:

- Regular expressions are not supported.

- If the OS of the execution target server is Windows, to specify the following symbols, prefix a backslash (\) to them as an escape character: \ [ ] ? ^ + * . @

Note, however, that to specify \ at the end of a character string or to specify only \, enter \\\\.

To specify a character string that includes spaces or any of the following symbols, prefix a grave accent mark (`) to the string as an escape character: # { } ' ; & , ` < >

However, that to specify only one or more spaces, enclose it with single quote (') (Example. ' '). To specify (, ), |, or $, prefix both a backslash and a grave accent mark (\`) to them as escape characters.

- If the OS of the execution target server is UNIX, to use a backslash (\) as an ordinary character, specify \\ instead of \. Also, to use the following symbols, prefix a backslash (\) to them as an escape character: ! $ [ ] / . ^ *

- Never enter a double quotation mark (") regardless of whether the OS is Windows or UNIX. To specify a double quotation mark ("), enter \0x22.

Notes on specifying the common.replaceStr property:

- If the OS of the execution target server is Windows, you can use the meta characters `t (tab) and `r`n (line break). To specify \ at the end of a character string or to specify only \, enter \\.

To specify a character string that includes spaces or any of the following symbols, prefix a grave accent mark (`) to the string as an escape character: ` # , @ | { } ' ; & ( ) < > $

However, that to specify only one or more spaces, enclose it with single quote (') (Example. ' ')

- If the OS of the execution target server is UNIX, you can use the meta characters \t (tab) and \n (line break). To use a backslash (\) as an ordinary character, specify \\, instead of \. Also, to include !, /, $, or & in a character string, prefix a backslash (\) to the string as an escape character.

- Never enter a double quotation mark (") regardless of whether the OS is Windows or UNIX. To specify a double quotation mark ("), enter \0x22.

Use situation

This plug-in can be used to edit definition files.

Prerequisites

See Release Notes for the latest support statuses of prerequisite products in the system, prerequisite products on the execution target server, and OSs of prerequisite products on the execution target server.

Prerequisite products for the system:

JP1/Automatic Operation 11-00 or later

Prerequisite products for the execution-target server:

None.

Supported OSs for the prerequisite products for the execution-target server:

(1) Windows Server 2008 R2 Standard/Enterprise/Datacenter

(2) Windows Server 2012 Standard/Datacenter, Windows Server 2012 R2 Standard/Datacenter

(3) Windows Server 2016 Standard/Datacenter

(4) Windows Server 2019 Standard/Datacenter

(5) Red Hat Enterprise Linux Server 6 (32-bit x86), Red Hat Enterprise Linux Server 6 (64-bit x86_64)

(6) Red Hat Enterprise Linux Server 7 (64-bit x86_64)

(7) Red Hat Enterprise Linux Server 8 (64-bit x86_64)

(8) CentOS 6 (64-bit x86_64)

(9) CentOS 7 (64-bit x86_64)

(10) CentOS 8 (64-bit x86_64)

(11) Oracle Linux 8 (64-bit x86_64)

(12) AIX V6

(13) AIX V7

Conditions for using prerequisite products on the execution target server:

None.

Cautions

(1) Do not simultaneously execute multiple instances of this plug-in for the same file.

(2) You cannot specify surrogate pair characters or control characters.

(3) If a locale environment variable (such as LC_ALL or LC_MESSAGES) that has higher priority than LANG has been specified, the higher-priority locale environment variable will take precedence over LANG. Therefore, when executing a plug-in, cancel the higher-priority locale environment variable (such as LC_ALL or LC_MESSAGES) or change its value to the same value as the LANG environment variable.

Version

03.01.00

Plug-in tags

Control OS,Windows,Linux,AIX

Plug-in name displayed in the task log

osReplaceString

Return code

0: Normal

14: Error (Mistake by user) File inaccessible

27: Error (Check with the task log about the error detail) Unidentified error

41: Error (An error has been detected in the component) Property not entered (An error has been detected in the component script)

Property list

The following table lists the properties:

Property key

Property name

Description

Default value

I/O type

Required

plugin.destinationHost

Host name of the execution target server

Specify the host name or IP address of the server on which this plugin will be executed. IPv6 addresses are not supported.

--

Input

R

common.strFilePath

File path that replaces a character string

Specify the full path for the file that replaces a character string.

--

Input

R

common.replaceTarget

Character string to be replaced

Specify the character string to be replaced in the file. We recommend that you specify a string of 1024 characters or less. If you specify a character string that exceeds the recommended value, part of the specified character string may be deleted depending on the OS of the execution target server.

--

Input

R

common.replaceStr

Replaced character string

Specify the replaced character string. We recommend that you specify a string of 1024 characters or less. If you specify a character string that exceeds the recommended value, part of the specified character string may be deleted depending on the OS of the execution target server.

--

Input

O

common.returnValue

Return value for the plugin

The return value of this plugin stored.

--

Output

O