Overview
Script task to perform find and replace.
Setup
Script to:
- Find specific combination in a Source or ...
- Find specific combination in a Source, replace with another combination and store in a Target.
The Source and Target can be either a file or System.IO.Stream object. When you want to specify special control characters use "\" to escape it. For example carriage return is "\r" and line feed is "\n".
When specified action is "Find", the task provides following parameters:
- Find - combination to match.
- StartIndex - position from where to start the search.
- ResultVariable - package variable where to store found index.
- IsSourceVariable - if true, Source is contained in package variable. Otherwise it is file connection manager (Boolean).
- SourceVariable - source package variable (String). The variable type can be either string (source file path) or Object (Stream).
- Source - source file connection manager (Connection).
When specified action is "FindAndReplace", the task provides following parameters:
- Find - combination to match.
- Replace - combination to use as a replacement for a match.
- IsSourceVariable - if true, Source is contained in package variable. Otherwise it is file connection manager (Boolean).
- SourceVariable - source package variable (String). The variable type can be either string (source file path) or Object (Stream).
- Source - source file connection manager (Connection).
- IsTargetVariable - if true, Target is contained in package variable. Otherwise it is file connection manager (Boolean).
- TargetVariable - target package variable (String). The variable type can be either string (source file path) or Object (Stream).
- Target - target file connection manager (Connection).
Configuration
To use this script, you would need to load it in COZYROC JavaScript Task. If you are using COZYROC SSIS+ 2.0 or later, after selecting the corresponding script type and opening the component editor, you can select the script from a dropdown list with the pre-built scripts. For COZYROC SSIS+ 1.9, you can download the JavaScript file and browse to it via the "Import JavaScript code" button.
Find_and_Replace_Task.jsKnowledge Base
COZYROC SSIS+ Components Suite is free for testing in your development environment.
A licensed version can be deployed on-premises, on Azure-SSIS IR and on COZYROC Cloud.