Powershell script to read coulumn 2 data from .csv file

  • Thread starter Naveen Chillamcharla
  • Start date
N

Naveen Chillamcharla

I'm trying to write a PowerShell script to get of 2 column of a .csv file. Can anyone help me here.

My .csv file looks like below

ProductName ProductCode
Java 7 {26374892-xxxx-xxxx-xxxx-123456789012}
Java 8 {26374892-xxxx-xxxx-xxxx-902341562789}

I want to get only ProductCode column values to use in a foreach loop.

I tried in below way

$code1 = Get-Contect %path% | Foreach-Object { $_ -split '\s+' | Select-object -skip 1 | Select-Object -Last 1 }

foreach($code in $code1)
{
write-host $code
}

I'm getting below output

67,{232424-55567-8879-xxxxxxx}

25,{324356456-5674-xxxx-xxxxxx}

But I want output only product codes like {3245345345-3454-56656757-xxxxx}

Continue reading...
 
Back
Top Bottom