4 ms·
If bash is the shell (assuming recursive search is required), maybe it would be even faster to just do: shopt -s globstar mawk '/Result/ { game
by decisiveness 12y ago
If bash is the shell (assuming recursive search is required), maybe it would be even faster to just do:
shopt -s globstar
mawk '/Result/ {
game++
split($0, a, "-")
res = substr(a[1], length(a[1]), 1)
if(res == 1)
white++
if(res == 0)
black++
if(res == 2)
draw++
} END {
print game, white, black, draw
}' **/*.pgn
?