title: How to replace an entire line in text file by only knowing a portion of the line?
body: <p>I have a text file that contains a like that is similar to</p>
  
  <p><code>Settings amount ="01:00:00"</code></p>
  
  <p>I know how to replace the line but my issue is at the moment I am only able to replace the entire line if I know the exact contents of the line- using <code>-match</code> and <code>-replace</code>. However, is there a way that I can search for just <code>Settings amount =</code> and then just replace that entire line with my new setting? That way no matter what the current value is I have the power to scan and give it a different value.</p>
  
  <p>This is what I have currently.</p>
  
  <pre><code>$DesiredTime = 'Settings amount="06:00:00" /&gt;'
  
  $path = "C:\Windows\File.txt" 
   (Get-Content $path) -replace 'Settings amount="01:00:00" /&gt;', $DesiredTime | out-file $path
  </code></pre>
  
  <hr>
  
  <p>Any ideas?</p>