Created
October 28, 2024 13:10
-
-
Save ottijp/070582f0537cf8f57cf11a85e96fdb66 to your computer and use it in GitHub Desktop.
YN Stats script
This file contains 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
ユーザーA: YYYYN | |
ユーザーB: NNYNN | |
ユーザーC: YNYNY | |
ユーザーD: YYNNY | |
ユーザーE: NYYYY | |
ユーザーF: YNYYN | |
ユーザーG: NNNNN | |
ユーザーH: YYYYN | |
ユーザーI: NYNYN | |
ユーザーJ: YNYYY |
This file contains 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 chat-history.txt | ./yn-stats.sh |
This file contains 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
#!/bin/bash | |
grep -oE '[YN]{5}' | tr YN 10 | | |
awk '{ | |
for (i = 1; i <= 5; i++) sum[i] += substr($0, i, 1) | |
} | |
END { | |
for (i = 1; i <= 5; i++) printf "%d: %d (%.2f%%)\n", i, sum[i], (sum[i] / NR) * 100 | |
}' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment