title: powershell script to extract specific column from csv file and store in array
body: <p>My csv file looks like this</p>
  
  <pre><code>Product_Name    Component           SvnDirectory
  ABC             export-service      export
  ABC             import-service      import
  ABC             service-service     service
  </code></pre>
  
  <p>My script should read this file and extract SvnDirectory column and store its values(export, import,service)in an array. I will later be using this to checkout from svn.</p>
  
  <p>The script is </p>
  
  <pre><code>$svnDirectory= Import-Csv C:\temp\checkoutdirs.csv | % {$_.SvnDirectory}
  Write-host $svnDirectory
  </code></pre>
  
  <p>The problem with this is, it stores values in such a way that I am not able to use it to checkout from svn. </p>
  
  <pre><code>Output
  @Write-host $svnDirectory
  export    import    service
  </code></pre>
  
  <p>So when I try to checkout using this</p>
  
  <pre><code>ForEach ($i in $svnDirectory) {
      $checkoutUrl = "$svnRepositoryBase/$svnDirectory/trunk"
      Write-host "SVN url to be checked out is $checkoutUrl"
      java -classpath $env:CLASSPATH org.tmatesoft.svn.cli.SVN co $checkoutUrl --username $username --password $securePassword --non-interactive
  }
  </code></pre>
  
  <p>The svn url it takes is </p>
  
  <pre><code>SVN url to be checked out is 
  http://subversion.abc.com/dev/prj/export  import  service/trunk
  </code></pre>