1

I have a .tex file in which I want to replace the string a\a{nn}o with a(nn)o

I have tried the following PowerShell (v5) code:

(Get-Content h:\combined.tex) | ForEach-Object { $_ -replace "a\a{nn}o", "a(nn)o" } `
    | Set-Content h:\combined2.tex

It runs, but nothing changes in the text. What am I doing wrong?

jpaugh
  • 1,390

1 Answers1

0

I got it to work with the following:

$(Get-Content .\temp) -replace "123","ABC" | Set-Content temp2

The for loop is unnecessary, and I believe it (or the pipe) may be causing the problem

jpaugh
  • 1,390