"Find Or Replace" Finds (i.e., counts) or replaces particular words or phrases in files. It can also handle special characters such as tabs and line feeds.
Input Parameters
FindOrReplace_Find (Required) - Specifies a value to find.
FindOrReplace_Replace - Specifies a value to replace. (Ignored if Action is "Find".)
FindOrReplace_Action (Required) - Specifies whether to just find (and count) instances or replace them as well.
FindOrReplace_CaseSensitive (Required) - Specifies whether comparisons are case sensitive or not.
FindOrReplace_SkipFileSizeMB - If a file is larger than this (MB) and if special characters are being used, then skip that file (for performance reasons). The default is 100; maximum value is 500 (500MB).
Output Parameters
FindOrReplace_Count - Returns the number of times the Find value appeared in this file.
FindOrReplace_CountTask - Returns the number of times the Find value appeared in all files encountered during this task run.
Special Characters
FindOrReplace can handle special character operations such replacing all tabs with three spaces or stripping carriage returns from a file. To work with special characters, you must represent them using special character "macros" in your FindOrReplace_Find or FindOrReplace_Replace parameters as appropriate.
The following special character macros are supported.
[char_cr] - Carriage return (ASCII 13)
[char_lf] - Line feed (ASCII 10)
[char_crlf] - Carriage return followed by a line feed (ASCII 13+10)
[char_tab] - Tab (ASCII 9)
[char_ff] - Form feed (ASCII 12)
[char_null] - Null (ASCII 0)
[char_###] - ASCII code ###
For example, to:
...replace tabs with three spaces, configure:
FindOrReplace_Find = "[char_tab]"
FindOrReplace_Replace = " "
...strip line feeds, configure:
FindOrReplace_Find = "[char_lf]"
FindOrReplace_Replace = ""
...add a carriage return to the end of each line feed, configure:
FindOrReplace_Find = "[char_lf]"
FindOrReplace_Replace = "[char_crlf]"
...replace "doAg" with "BonE", configure:
FindOrReplace_Find = "do[char_65]g"
FindOrReplace_Replace = "[char_66]on[char_69]"
Notes
Please only use the replace operation this against text files as replacing text in a binary file could have unforeseen consequences.
This built-in script may only be run per-file. This built-in script may not be run as the first step of a task.
Example #1
Ed would like email listing how many times the word "- PAGE" appears in files that pass through MOVEit Central.
To perform this operation with MOVEit Central, Ed should...
Create a new task with a source, process, destination, schedule and next action.
Select "Find Or Replace" as his process
Set process parameters:
FindOrReplace_Action = "Find"
FindOrReplace_Find = "- PAGE"
FindOrReplace_CaseSensitive = "Yes"
Configure his next action to:
send him an email with the macro "[Parm:FindOrReplace_Count]" in the message body.
run per-file (not per-task).
Example #2
Jane would like to replace all instances of "bubbler" with "drinking fountain" in files that pass through MOVEit Central.
To perform this operation with MOVEit Central, Jane should...
Create a new task with a source, process, destination and schedule.