Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $a = Import-Csv .table1.txt
- $a | FT -AutoSize
- $Duration = Measure-Command {
- $b = @()
- foreach ($Property in $a.Property | Select -Unique) {
- $Props = [ordered]@{ Property = $Property }
- foreach ($Server in $a.Server | Select -Unique){
- $Value = ($a.where({ $_.Server -eq $Server -and
- $_.Property -eq $Property })).Value
- $Props += @{ $Server = $Value }
- }
- $b += New-Object -TypeName PSObject -Property $Props
- }
- }
- Write-Host "Finished transposing " -ForegroundColor Green -NoNewline
- Write-Host "$(($a | Get-Member -MemberType Properties).count)/$($a.Count)" -ForegroundColor Yellow -NoNewline
- Write-Host " columns/rows into " -ForegroundColor Green -NoNewline
- Write-Host "$(($b | Get-Member -MemberType Properties).count)/$($b.Count)" -ForegroundColor Yellow -NoNewline
- Write-Host " columns/rows in " -ForegroundColor Green -NoNewline
- Write-Host $Duration.Milliseconds -ForegroundColor Yellow -NoNewline
- Write-Host " Milliseconds" -ForegroundColor Green
- $b | FT -AutoSize
- $b | Out-GridView
- $b | Export-Csv .table2.txt -NoTypeInformation
- $a = Import-Csv .table1.txt
- $a | FT -AutoSize
- $Duration = Measure-Command {
- $b = @()
- foreach ($Property in $a.Property | Select -Unique) {
- $Props = [ordered]@{ Property = $Property }
- foreach ($Server in $a.Server | Select -Unique){
- $Value = ($a.where({ $_.Server -eq $Server -and
- $_.Property -eq $Property })).Value
- $Props += @{ $Server = $Value }
- }
- $b += New-Object -TypeName PSObject -Property $Props
- }
- }
- Write-Host "Finished transposing " -ForegroundColor Green -NoNewline
- Write-Host "$(($a | Get-Member -MemberType Properties).count)/$($a.Count)" -ForegroundColor Yellow -NoNewline
- Write-Host " columns/rows into " -ForegroundColor Green -NoNewline
- Write-Host "$(($b | Get-Member -MemberType Properties).count)/$($b.Count)" -ForegroundColor Yellow -NoNewline
- Write-Host " columns/rows in " -ForegroundColor Green -NoNewline
- Write-Host $Duration.Milliseconds -ForegroundColor Yellow -NoNewline
- Write-Host " Milliseconds" -ForegroundColor Green
- $b | FT -AutoSize
- $b | Out-GridView
- $b | Export-Csv .table2.txt -NoTypeInformation
- $a = Import-Csv .table1.txt
- $a | FT -AutoSize
- $Duration = Measure-Command {
- $b = @()
- foreach ($Property in $a.Property | Select -Unique) {
- $Props = [ordered]@{ Property = $Property }
- foreach ($Server in $a.Server | Select -Unique){
- $Value = ($a.where({ $_.Server -eq $Server -and
- $_.Property -eq $Property })).Value
- $Props += @{ $Server = $Value }
- }
- $b += New-Object -TypeName PSObject -Property $Props
- }
- }
- Write-Host "Finished transposing " -ForegroundColor Green -NoNewline
- Write-Host "$(($a | Get-Member -MemberType Properties).count)/$($a.Count)" -ForegroundColor Yellow -NoNewline
- Write-Host " columns/rows into " -ForegroundColor Green -NoNewline
- Write-Host "$(($b | Get-Member -MemberType Properties).count)/$($b.Count)" -ForegroundColor Yellow -NoNewline
- Write-Host " columns/rows in " -ForegroundColor Green -NoNewline
- Write-Host $Duration.Milliseconds -ForegroundColor Yellow -NoNewline
- Write-Host " Milliseconds" -ForegroundColor Green
- $b | FT -AutoSize
- $b | Out-GridView
- $b | Export-Csv .table2.txt -NoTypeInformation
Add Comment
Please, Sign In to add comment