title: Powershell to remove particular text from a file
body: <p>Im not really sure how best to approach this.
  I want to replace text in xml.rels files.</p>
  <p>They contain xml data but dont seem to like being opened with $xml=New-Object XML</p>
  <p>I want to remove all path information in the Target tag.</p>
  <p>A file example is ...</p>
  <pre><code>&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;yes&quot;?&gt;
  &lt;Relationships xmlns=&quot;http://schemas.openxmlformats.org/package/2006/relationships&quot;&gt;&lt;Relationship Id=&quot;rId1&quot; Type=&quot;http://schemas.openxmlformats.org/officeDocument/2006/relationships/externalLinkPath&quot; Target=&quot;/Finance/Audit/Mgt%20Accts%202020/MGT%20ACCTS%20-%20Copy2/Mgt%20Accts%20MAR%2020.xlsx&quot; TargetMode=&quot;External&quot;/&gt;&lt;/Relationships&gt;
  </code></pre>
  <p>So in thie case I wish the file to become...</p>
  <pre><code>&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;yes&quot;?&gt;
  &lt;Relationships xmlns=&quot;http://schemas.openxmlformats.org/package/2006/relationships&quot;&gt;&lt;Relationship Id=&quot;rId1&quot; Type=&quot;http://schemas.openxmlformats.org/officeDocument/2006/relationships/externalLinkPath&quot; Target=&quot;Mgt%20Accts%20MAR%2020.xlsx&quot; TargetMode=&quot;External&quot;/&gt;&lt;/Relationships&gt;
  </code></pre>
  <p>Now the Target could contain any path so I would need to find the last &quot;/&quot; in Target and just keep the text after that.</p>
  <p>Thanks for any help at all.
  P</p>