title: Script to replace string of text at a end of a line
body: <p>I would like to modify this script if possible:</p>
  <pre><code>((Get-Content -path &quot;C:\Users\User1\OUT\Summary.txt&quot; -Raw) -replace '&lt;/ab&gt;&lt;/cb&gt;','&lt;/x&gt;') | Set-Content -Path &quot;C:\Users\User1\OUT\Summary.txt&quot;
  </code></pre>
  <p>I would like a script that will run with Windows OS to search through one file it finds at this path:</p>
  <pre><code>C:\Users\User1\File\Summary.txt
  </code></pre>
  <p>And within that file, when it finds data starting with: <code>&lt;a&gt;&lt;b&gt;Data</code></p>
  <p>And at the same time ending with: <code>&lt;/ab&gt;&lt;/cb&gt;</code></p>
  <p>It would need to change the ending to: <code>&lt;/x&gt;</code>
  And it would need to save the file without changing the name of the file.</p>
  <p>For instance a line showing this data:</p>
  <pre><code>&lt;a&gt;&lt;b&gt;Data:&lt;/y&gt; 12345678&lt;/ab&gt;&lt;/cb&gt;
  </code></pre>
  <p>Would be changed to:</p>
  <pre><code>&lt;a&gt;&lt;b&gt;Data:&lt;/y&gt; 12345678&lt;/x&gt;
  </code></pre>
  <p>The PowerShell script above will find all instances of <code>&lt;/ab&gt;&lt;/cb&gt;</code> and replace it with <code>&lt;/x&gt;</code>, which is not what I am hoping to accomplish.</p>