title: Read file line by line in PowerShell
body: <p>I want to read a file line by line in PowerShell. Specifically, I want to loop through the file, store each line in a variable in the loop, and do some processing on the line.</p>
  
  <p>I know the Bash equivalent:</p>
  
  <pre><code>while read line do
      if [[ $line =~ $regex ]]; then
            # work here
      fi
  done &lt; file.txt
  </code></pre>
  
  <p>Not much documentation on PowerShell loops.</p>