Created
August 2, 2014 07:39
-
-
Save ryo1kato/a36190e9ce25ab89067a to your computer and use it in GitHub Desktop.
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
| cat result | while read t p; do t1=${t%-*}; t2=${t#*-}; p1=${p%-*}; p2=${t#*-}; t+=(t1 $t2); if (( p1 > p2 )); then echo ${t1} win; echo ${t2} lose; else echo ${t2} win; echo ${t1} lose; fi; done | sort | uniq -c |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
$ cat calc.bash #!/bin/bash while read t p do t1=${t%-*} t2=${t#*-} p1=${p%-*} p2=${t#*-} #t+=(t1 $t2) if (( p1 > p2 )) then echo ${t1} win echo ${t2} lose else echo ${t2} win echo ${t1} lose fi done | sort | uniq -c $ ./calc.bash < result 2 A lose 1 A win 2 B lose 2 B win 1 C lose 2 C win