title: PowerShell - Csv : foreach with conditions?
body: <p>I have to import a csv file, and I want to put a condition directly in the foreach.
  I mean :</p>
  
  <p>To read the csv, i do (yes my delimiter is \ ) :</p>
  
  <pre><code>$csv = Import-Csv -Delimiter \ -Path $mypath -Header 'column1', 'column2', 'column3'
  </code></pre>
  
  <p>Then i do :</p>
  
  <pre><code>foreach($line in $csv)
  {
  #Actions
  }
  </code></pre>
  
  <p>What i would like to do, but I din't know if it's possible :</p>
  
  <pre><code>for($i =1; $i -lt $myarray.Length; $i++)
  {
     foreach($line in $csv) | Where $line.column2 -eq $myarray[$i]
     {
        #Actions only if $line.column2 is equal to $myarray[$i]
     }
  }
  </code></pre>
  
  <p>So i got an array, with names inside. And I want to do #Actions, only if a column in the csv, match to the information in my array. If not, I want to change of $line in $csv.</p>
  
  <p>The idea i wrote looks so heavy, and I think there is a better and faster (harder and stronger #DaftPunk) way to do this. </p>
  
  <p>If someone has already use this before, let me know :)</p>
  
  <p>Thanks in advance,</p>
  
  <p>Nico.</p>
  
  <p>P.S : I apologize for my english ;)</p>
  
  <p>EDIT : I've just realized that i can do a if condition :</p>
  
  <pre><code>for($i =1; $i -lt $myarray.Length; $i++)
  {
     foreach($line in $csv)
     {
        if($line.column2 -eq $myarray[$i]
        {
           #Actions
        }
     }
  }
  </code></pre>
  
  <p>But i still think that a :   | Where #Conditions, is better ...</p>