Проблема сортировки массива по определенному столбцу.
[PSObject[]]$arr = @()
$arr += [PSObject]@{
who = 'z';
what = 'snake';
where = 'c1';
when = 'd1'
}
$arr += [PSObject]@{
who = 'z';
what = 'beer';
where = 'c1';
when = 'd1'
}
$arr += [PSObject]@{
who = 'a';
what = 'snake';
where = 'c1';
when = 'd1'
}
$arr += [PSObject]@{
who = 'b';
what = 'ape';
where = 'c1';
when = 'd1'
}
$arr | Sort-Object what
Вывод:
Name Value
---- -----
where c1
who a
when d1
what snake
where c1
who b
when d1
what ape
where c1
who z
when d1
what snake
where c1
who z
when d1
what beer
Таким образом, не отсортировано по «чему».
Любая идея, пожалуйста