Created
March 1, 2016 16:36
-
-
Save cdhunt/5c9a569aad952b1a4d96 to your computer and use it in GitHub Desktop.
Beating Hadoop with Posh
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Black White Tie RunTime | |
----- ----- --- ------- | |
2853633 3762820 3260741 6 minutes, 45 seconds, 347 milliseconds |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# http://foxdeploy.com/2016/03/01/powershell-challenge-beating-hadoop-with-posh/ | |
# Most of the code is output formatting; the processing is a one-liner with v1 cmdlets | |
$start = [DateTime]::Now | |
$results = Get-ChildItem C:\Temp\ChessData-master -Recurse -filter *.pgn | Select-String -Pattern "Result" | Group-Object Line -NoElement | |
$black = $results.Where({$_.Name -eq '[Result "0-1"]'}) | Select-Object -ExpandProperty Count | |
$white = $results.Where({$_.Name -eq '[Result "1-0"]'}) | Select-Object -ExpandProperty Count | |
$tie = $results.Where({$_.Name -eq '[Result "1/2-1/2"]'}) | Select-Object -ExpandProperty Count | |
[PSCustomObject]@{Black=$black; White=$white; Tie=$tie; RunTime=([DateTime]::Now - $start)} | Write-Output |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment