Skip to content

Instantly share code, notes, and snippets.

@jstangroome
Created May 27, 2011 06:54
Show Gist options
  • Save jstangroome/994770 to your computer and use it in GitHub Desktop.
Save jstangroome/994770 to your computer and use it in GitHub Desktop.
Streaming implementation of PowerShell's Select-Object -Unique
&{
1..7
4..9
} |
ForEach-Object -Begin {
$Unique = @{}
} -Process {
if (-not $Unique.ContainsKey($_)) {
$Unique.Add($_, $null)
$_
}
} -End {
$Unique.Clear()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment