PowerShell creates a file for each individual record.

Working with a large CSV file, as shown below ... You need to create a loop and create files for each application distince AppID ie below it will have three files for AppID 1,3 and 5. Any help to do this with powershell will be appreciated . Thank.

Col1   | AppID
data11 | 1
data12 | 1
data13 | 1
data31 | 3
data32 | 3
data51 | 5
data52 | 5
+3
source share
1 answer

Assuming you want to use the panel as a separator, then this should work:

import-csv .\foo.csv -Delimiter '|' | group-object appid | foreach-object {
    $_.group | Export-Csv "appid_$($_.name).csv" -NoTypeInformation }

Hope this helps.

+3
source

All Articles