4.13.19 Extract character string in a text file
Function
This plug-in sets the line specified by the specified text file to the output property on the Windows or Unix execution target server. If the specified line exceeds 1,024 bytes, character strings of 1,025 bytes or more will be truncated.
If no corresponding line exists (for instance, if
If no corresponding line exists (for instance, if the 21st line is specified for a text file having only 20 lines), a null character is set for the output property.
The prerequisite server for this plug-in is as follows:
- Execution target server
This server is used as the target for executing this plug-in.
Scripts in this plug-in perform the following processing:
- Checking the file path specified for the target file (common.targetFilePath property)
- Execution of the following command
- Windows
New-Object System.IO.StreamReader("target-file-path(common.targetFilePath-property)", [System.Text.Encoding]::Default)
The readLine method of the StreamReader object acquired by the above command is used to acquire the one line of character string specified in the line number (common.lineNum property).
For details about the readLine method of the StreamReader class, visit the Microsoft library Web site.
- Unix
head -n line-number(common.lineNum-property) "target-file-path(common.targetFilePath-property)" | tail -n 1
For details on the head and tail commands, run the man command of the OS to acquire the command information.
Use situation
Used when specifying part of a text file to the output property to be used as the input property of another product
Prerequisites
For the latest support status of the following items, see the Release notes: Prerequisite product within the system, prerequisite products on the execution target server, and running OS for prerequisite products on the execution target server.
Prerequisite product within the system:
- JP1/Automatic Operation 11-00 or later
Prerequisite product within the execution target server:
None
Running OS on 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)
Conditions of using the execution target server:
None
Cautions
(1) Do not use a character string containing a double quotation mark (") or a single quotation mark (') in a plug-in property.
(2) You cannot use a wild card for specification to the target file path (common.targetFilePath property).
(3) The connected user defined for the agentless connection destination requires read permission for the specified file.
Version
02.00.00
Plug-in tags
Gather OS information,Windows,Linux
Plug-in name displayed in the task log
osFileOutputProperty
Return code
0: Normal
21: Error (invalid environment) Command cannot be found (error detected in the plugin script)
27: Error (check task logs for the nature of error)
41: Error (error detected in plugin) Missing property (error detected in plugin 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.targetFilePath |
Target file path |
Enter the full path of the target file. |
-- |
Input |
R |
common.lineNum |
Line number |
Specify a line from which you want to extract a character string. |
-- |
Input |
R |
common.stdOutValue |
Character string to be extracted |
The character string extracted from the file is stored here. |
-- |
Output |
O |
common.returnValue |
Return value for the plugin |
The return value of this plugin stored. |
-- |
Output |
O |