title: Replace multiple strings in a file with Powershell
body: <p>We want to replace multiple instances of the variable <code>id=*</code>, with a certain pattern, like <code>id=1234</code>.
  I already made this Powershell script (and prefer to keep using Powershell as solution):</p>
  
  <pre><code>$line = Get-Content C:\test.txt | Select-String "id=" | Select-Object -ExpandProperty Line
  $content = Get-Content C:\test.txt
  $content | ForEach {$_ -replace $line,"id=1234"} | Set-Content C:\test.txt
  Get-Content C:\test.txt
  </code></pre>
  
  <p>This works, as long as there's only 1 instance of <code>id=...</code>, when a file contains multiple instances of <code>id=...</code> there is no replacement step performed at all.</p>
  
  <p>The input file is similar to:</p>
  
  <pre><code>text over here
  id=1
  text over here: id={123456}
  text
  id=number1
  id=#3 text 
  id=3+3 text 
  </code></pre>
  
  <p>which should result in:</p>
  
  <pre><code>text over here
  id=1234
  text over here: id=1234
  text
  id=1234
  id=1234 text 
  id=1234 text 
  </code></pre>