Skip to content

Instantly share code, notes, and snippets.

@MVKozlov
Last active April 15, 2016 13:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MVKozlov/33e6d440fc6a99af6cc1dd776cda2ae5 to your computer and use it in GitHub Desktop.
Save MVKozlov/33e6d440fc6a99af6cc1dd776cda2ae5 to your computer and use it in GitHub Desktop.
PS D:\> $Indicator = @{ '=>' = 'Right'; '<=' = 'Left'; '==' = 'Same' }
>>> $Indicator
Name Value
---- -----
== Same
<= Left
=> Right
PS D:\> $c1 = import-csv d:\c1 -delim "`t"
>>> $c1
Name Value
---- -----
a1 v1
a2 v2
a3 v3
PS D:\> $c2 = import-csv d:\c2 -delim "`t"
>>> $c2
Name Value
---- -----
a1 vb2
b2 vb2
b3 v3
PS D:\> Compare-Object -IncludeEqual $c1 $c2 -Property Name | Select-Object Name, Value, @{Label = 'SideIndicator'; Expression = { $Indicator[$_.SideIndicator] } }
>>>
Name Value SideIndicator
---- ----- -------------
a1 Same
b2 Right
b3 Right
a2 Left
a3 Left
PS D:\> Compare-Object -IncludeEqual $c1 $c2 -Property Name -PassThru | Select-Object *, @{Label = 'Side'; Expression = { $Indicator[$_.SideIndicator] } }
>>>
Name Value SideIndicator Side
---- ----- ------------- ----
a1 v1 == Same
b2 vb2 => Right
b3 v3 => Right
a2 v2 <= Left
a3 v3 <= Left
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment