title: Powershell if statement in pipeline
body: <p>I am in need to create a script which can continuously read a file and if a certain line with text comes, to call a function.</p>
  
  <p>I am thinking in a way to do this a single line thing with</p>
  
  <pre><code>Get-Content -Path $logFile -wait | ?{$_-match "$filter"}
  </code></pre>
  
  <p>but I am not aware of a way to call a function if the line does answer the criteria.</p>
  
  <p>Is that doable ? or I should do it like in a loop to read the file every cycle and if there is a match to exit the loop ?</p>