title: How to stop Get-Content -wait after I find a particular line in the text file using powershell? Exit a pipeline on demand
body: <p>I am using this below script in Powershell (Version is 5.1):</p>
  
  <pre><code>Get-Content -Path path\to\text\file\to\be\read.txt -Wait
  </code></pre>
  
  <p>Now this continues to read even after the file is getting no update.
  How can I stop after I find particular line in the text file?
  Is there any other way to stop this on condition?</p>