Page 1 of 1

Replace in Files not acting as expected

Posted: Fri Feb 24, 2017 11:04 am
by KenJFried
Product, version and build: Primal Script 2017, Version 7.3.99
(*** Please do not write "latest" as a version, specify a version number ***)
32 or 64 bit version of product: 64 bit
Operating system: Windows 7
32 or 64 bit OS: 64 bit

DO NOT POST SUBSCRIPTIONS, KEYS OR ANY OTHER LICENSING INFORMATION IN THIS FORUM

I'll admit I'm a new user but I have done my level best at finding this in the documentation and forum posts for what I think should be the a simple task.

I am trying to use the Replace in Files function for the second use item for this product. For my first use item I ran a Find in Files for the following entry in xml: //kmhpsftpreppa20/SFTP/sftp root/
This was done in a folder with many subfolders and it found 69 instances in various files in folders and various lines in the folders

When I try to run the Replace in Files item to replace the above text with the following text: ${TidalVar_//KMHPSFTPREPPA20/SFTP/}
the result gives me a listing that all 69 instances are replaced.

When validating the results I get the following:
the first instance of the find / replace in a file give me this, which is correct:
--source="${TidalVar_//KMHPSFTPREPPA20/SFTP/}statepa/47TPL766"

The next two instances in the same file give me this, which is not correct, it's replacing two characters further to the left:
--sourc"${TidalVar_//KMHPSFTPREPPA20/SFTP/}t/statepa/57TPL766"
--sou"${TidalVar_//KMHPSFTPREPPA20/SFTP/}oot/statepa/37TPL766"

This appears to happen in any file where there is more than one occurrence of the replace. The first occurrence is always correct but subsequent occurrences are off two characters to the left. I can, of course, manually fix these but it seems like this should work correctly. The file replacements are not the first lines in the xml, often times 40-70 lines deep (there are repetitive xml tasks in many of these files). I haven't been able to find any special characters or other issues to date and thought I would ask if you had run into this before or had an idea.

I have attached one result file which is where the example above came from and the original source file from before the replace.

Thank you.

Re: Replace in Files not acting as expected

Posted: Fri Feb 24, 2017 11:17 am
by Alexander Riedel
Ok, thank you for the sample file. We will look into it right away.

Re: Replace in Files not acting as expected

Posted: Tue Mar 14, 2017 3:19 pm
by KenJFried
Hi - Is there any update to this issue? Thank you.

Re: Replace in Files not acting as expected

Posted: Tue Mar 14, 2017 9:38 pm
by Alexander Riedel
Yes, it has been resolved in the last update. See log :

7.3.100
Fix: Find and replace in files can place replacements incorrectly
Add: Packager Option - Do not execute if Script Block logging is enabled.
Add: Packager Option - Disable Script Block logging while running (Requires elevated admin privileges).