ReplaceInFile |
Top Previous Next |
×V4.5Ø
Syntax - ReplaceInFile <DestinationFilePathAndName> <SourceFilePathAndName> <RegExPattern> <ReplacementValue> [<ReadMethod>] Where: <DestinationFilePathAndName> is a literal string or a variable that contains a string. <SourceFilePathAndName> is a literal string or a variable that contains a string. <RegExPattern> is a literal string or variable that contains a string. <ReplacementValue> is a literal string or variable that contains a string. <ReadMethod> is one of the following: ReadFile, ReadLine Description: This command searches the file defined by <SourceFilePathAndName> for all matches to the specified <RegExPattern>. When a match is found it is replaced with the <ReplacementValue>. The results of the process are written to a new file defined by <DestinationFilePathAndName>. <ReadMethod> determines if EMUE reads the file entirely into memory for processing or reads it line by line. This is an optional parameter and if not specified will read the entire file for processing.
Sample 1: The following example looks for all tabs in Input.txt file and replaces any matches with nothing. A destination file, Output.txt, will be created with the results. ReplaceInFile "C:\EMUE\Output.txt" "C:\EMUE\Input.txt" "\t" "" ReadFile
Sample 2: The following example looks for curly braces from the source file and replaces any matches with nothing. A destination file will be created with the results. ReplaceInFile "C:\EMUE\Output.txt" "C:\EMUE\Input.txt" "\{|\}" "" ReadFile
|