title: Match Unique Value in Column and put all values on that row in to variables
body: <p>I'm working with a CSV with 5 Columns, One of the Columns has unique Values.</p>
  <pre><code>Fruit,  Number, Car, item,  color
  apple,  2,  Chevy,  ball,   blue
  apple,  1,  Ford,   ball,   green
  orange, 3,  Ford,   string, &quot;red,green&quot;
  orange, 5,  Mazda,  key,    red
  Banana, 4,  Tesla,  desk,   yellow
  </code></pre>
  <p>I need to search for 3 and have it return orange ford string &quot;red,green&quot; as their own variable</p>
  <p>i.e. $fruit1 becomes orange $car1 becomes ford $item becomes string and $color bcomes red,green</p>
  <p>I can do the search and have it tell me it found 3, but it still just puts runs everything through $fruit1  and if I tell it to write $fruit1 to a file it just get a repeating mess</p>
  <p>I Need to Get output to a TXT file like so</p>
  <pre><code>for #3 
  FRUIT=orange 
  Car=Ford 
  ITEM = string 
  COLOR =&quot;red,green&quot; 
  </code></pre>
  <p>whith each value in a different part of the file/newline</p>
  <p>I can't post from the machine the script is on. So values changed to match my example</p>
  <pre><code>Function LogWrite
  {
     Param ([string]$logstring)
  
     Add-content $Logfile -value $logstring
  }
  
  LogWrite &quot;Started execution of script.ps1&quot;
  
  $masterlist = Import-Csv  ($filepath + &quot;\&quot; + &quot;masterlistfile.csv&quot; )
  
  $FruitName = @()
  $NumberName = @()
  $Carname = @()
  $ItemName = @()
  $Colorname = @()
  
  
  $masterlist |ForEach-Object {
          $FruitName += $_.fruit
          $NumberName += $_.number
          $Carname += $_.car
          $Itemname += $_.item
          $Colorname += $_.color
      }
  
  
  $number = 3
  
  $FruitIdentified
  $CarIdentified
  $ItemIdentified
  $ColorIdentified
  
  LogWrite &quot;NUmber $number to be searched in masterlistfile &quot;
  if ($NumberName -eq $number)
      {
      LogWrite &quot;Number found in the list...&quot;
      $Where = [array]::IndexOf($NumberName, $number)
      LogWrite &quot;Fruit Name :  $FruitrName[$Where] &quot;
      $FruitIdentified = $FruitName[$Where]
      $CarIdentified = $CarName[$Where]
      $ItemIdentified = $ItemName[$Where]
  </code></pre>
  <p>}</p>