How to Change the Delimiter on a File (KBA1161)
At a Glance
Masking Versions: | This is applicable to all Delphix Masking versions. |
---|---|
Description: | This page specifically details how to change the End of Record (EOR) delimiter on a file so that it can be masked using File Masking should the EOR not be one of the predefined EOR. |
Built-in EOR: | The built-in End of Record delimiters are: |
Solution: | Connection Issue - Username or Password error
|
Solution: | Issue - No masking jobs
|
Issue - the End of Record delimiter not matching
Sometimes the End of Record (EoR) orEnd is specific to an application and needs to be changed. This can be due to the Masking Engine can't specify the specific EoR delimiter or the delimiter is a sequence of character.
Since the EoR, in this case, can't be specified in the masking engine we need to change it.
Resolution
The resolution to this issue is to work around the limitation by changing the EoR - since there are no scripting capabilities for masking jobs related to text files this needs to be done before the file is masked.
Unix
The character conversion can be performed using perl with the following command. This example changes from CR to LN.
perl -p -e 's/\r/\n/g' input.file > output.file
Windows PowerShell
In PowerShell on Windows, the following can be used. This example changes from CR to LN.
$original_file ='input.txt' $text = [IO.File]::ReadAllText($original_file) -replace "`r", "`n" [IO.File]::WriteAllText($original_file, $text)