title: How to match each line of a text file contents in powershell script
body: <p>I have a text file 'abc.txt' that contains the below.<br>
  hello_1<br>
  hello_2<br>
  ..<br>
  ..<br>
  hello_n    </p>
  
  <p>I need to write a script to open the file abc.txt and read each line and store that each line in a variable called $temp. I need to read the line only that starts with 'hello'.  What is wrong with the below code?<br>
  I have the below Code:    </p>
  
  <pre><code>foreach ($line in Get-Content "c:\folder\abc.txt")    
  {    
      if($line Select-String -Pattern 'hello')
      $temp=$line
  }
  </code></pre>