Powershell 从CSV合并列

Powershell 从CSV合并列,powershell,csv,Powershell,Csv,我有这样一个CSV: Group;Name;Color Fruit;Apple;green Vegetable;Carrot;orange Fruit;Banana;yellow Fruit;cherry;red Vegetable;cucumber;green Group;Name;color Fruit;{Apple,Banana,Cherry};{green,yellow,red} Vegetable;{Carrot;cucumber};{orange,green} 并希望将其合并(通

我有这样一个CSV:

Group;Name;Color
Fruit;Apple;green
Vegetable;Carrot;orange
Fruit;Banana;yellow
Fruit;cherry;red
Vegetable;cucumber;green
Group;Name;color
Fruit;{Apple,Banana,Cherry};{green,yellow,red}
Vegetable;{Carrot;cucumber};{orange,green}
并希望将其合并(通过PowerShell),以便每个组只显示一次,并在数组中与其相邻的相应“名称”(),如下所示:

Group;Name;Color
Fruit;Apple;green
Vegetable;Carrot;orange
Fruit;Banana;yellow
Fruit;cherry;red
Vegetable;cucumber;green
Group;Name;color
Fruit;{Apple,Banana,Cherry};{green,yellow,red}
Vegetable;{Carrot;cucumber};{orange,green}
用于按对象的属性对对象进行分组:

Import Csv'C:\path\to\input.Csv'-分隔符';'|
组对象组|
选择@{n='Group';e={$\u.Name},
@{n='Name';e={{{{0}}'-f(${.Group.Name-join',')},
@{n='Color';e={{{{0}}'-f(${.Group.Color-join',')}|
导出Csv'C:\path\to\output.Csv'-NoType-Delimiter';'