mardi 23 juin 2015

Powershell Split items in a string

I cant figure out how this works...please help...

$output = Get-EC2Instance |%{ $_.RunningInstance } | select-object InstanceId,@{Name='Key'; Expression={$_.Tag.Key} },@{Name='Value'; Expression={$_.Tag.Value} }

This command displays : enter image description here

I run the second command below which splits "Key" (Each instanceId has multiple Keys associated to it. Each key has its associated value):

$output  | %{$n=$_.InstanceId; $_.Key | select @{Name="InstanceID";Expression={$n}},@{Name="Key";Expression={$_}}}

The output is enter image description here

How to modify the second command to include "Value" column (each key has a associated value)?




Aucun commentaire:

Enregistrer un commentaire