aboutsummaryrefslogtreecommitdiff
path: root/games/pks.awk
diff options
context:
space:
mode:
authorTom Ryder <tom@sanctum.geek.nz>2017-07-02 02:13:25 +1200
committerTom Ryder <tom@sanctum.geek.nz>2017-07-02 02:13:25 +1200
commitca3cc521dd28478c9b51b7c3d9a176835cfa6fa9 (patch)
tree5b4e733d72785af750fa4cc164e85cff5f3b89b8 /games/pks.awk
parentBreak pks(6df) and philsay(6df) in two (diff)
downloaddotfiles-ca3cc521dd28478c9b51b7c3d9a176835cfa6fa9.tar.gz
dotfiles-ca3cc521dd28478c9b51b7c3d9a176835cfa6fa9.zip
Remove POSIX char classes from Awk
I forgot that Debian's awk(1) is still a mawk that doesn't implement e.g. [:alpha:]
Diffstat (limited to 'games/pks.awk')
-rw-r--r--games/pks.awk4
1 files changed, 2 insertions, 2 deletions
diff --git a/games/pks.awk b/games/pks.awk
index 06aad75f..028e471f 100644
--- a/games/pks.awk
+++ b/games/pks.awk
@@ -23,7 +23,7 @@ BEGIN {
# Iterate over the lines, randomly assigning the first field of each one with a
# decreasing probability; this method allows a single pass over the input,
# though it requires a lot of random numbers
-$1 ~ /[[:alpha:]]/ && rand() * ++n < 1 { wr = $1 }
+$1 ~ /[a-zA-Z]/ && rand() * ++n < 1 { wr = $1 }
# Ha, ha! Conclusion!
END {
@@ -33,7 +33,7 @@ END {
exit 1
# Strip trailing possessives and punctuation
- sub(/[^[:alpha:]]+s*$/, "", wr)
+ sub(/[^a-zA-Z]+s*$/, "", wr)
# Two or three "ha"s? Important decisions here folks
hr = int(rand()*2+1)