В соответствии с импортируемым рецептом Ансгара, возвращается группировка:
> Import-Csv .\SO_54925782.csv|Group-Object Name
Count Name Group
----- ---- -----
9 Mustermann,Max {@{Name=Mustermann,Max; Device=ABC1234; Program={Test\Test\Application in use}}...
5 Musterdame,Birgit {@{Name=Musterdame,Birgit; Device=CAD1234; Program={Test\Test\Application in use}}...
Сортировка по длине программы
Import-Csv .\SO_54925782.csv|Group-Object Name|ForEach-Object{
$_.Group|Sort-Object {$_.Program.Length};""
}
Name Device Program
---- ------ -------
Mustermann,Max ABC1234 {Test\Test\Application in use}
Mustermann,Max ABC1234 {Test\Test\Application in use}
...
Mustermann,Max ABC1234 {Test\Test\Application in use}
Mustermann,Max ABC1234 {Test\Test\Application in use\Addon}
Musterdame,Birgit CAD1234 {Test\Test\Application in use}
...
Musterdame,Birgit CAD1234 {Test\Test\Application in use\Addon}
и, наконец, выбор -Последний 1
Import-Csv .\SO_54925782.csv|Group-Object Name|ForEach-Object{
$_.Group|Sort-Object {$_.Program.Length}|Select-Object -Last 1
}
Name Device Program
---- ------ -------
Mustermann,Max ABC1234 {Test\Test\Application in use\Addon}
Musterdame,Birgit CAD1234 {Test\Test\Application in use\Addon}