What I am trying to do is to create a word document from the text file. But the text file has pageBreaks in it. I want to remove or replace those pageBreaks in the text file. This is to allow me to add pageBreaks in the word document that I'll subsequently create in places where I actually need it.
Below is the PowerShell code that I tried myself to replace the pageBreak in the text file. This doesn't work. As using "`f" in place of pageBreak doesn't work.
$oldWord = "`fPage"
$newWord = "Page"
#-- replace the page breaks in the file
(Get-Content $inputFilePath) -replace '$oldWord', '$newWord' | Set-Content $inputFilePath
The symbol shown for pageBreak in the text editor UltraEdit is ♀ Replacing the character in UltraEdit is easy. I want to replace or remove this using Powershell.
Below is a related question. But still unanswered with regards to PowerShell code.
How to remove unknown line break (special character) in text file?