tHide symbols trailing the tag and skip #nospoil - bitreich-memestats - statist… | |
git clone git://src.adamsgaard.dk/bitreich-memestats | |
Log | |
Files | |
Refs | |
--- | |
commit f8c777510e9663561ed292baaef1de5cfb7b4b91 | |
parent d08ff10b40479174b132e313726b406692972e35 | |
Author: Anders Damsgaard <[email protected]> | |
Date: Fri, 17 Apr 2020 10:02:44 +0200 | |
Hide symbols trailing the tag and skip #nospoil | |
Diffstat: | |
M Makefile | 2 +- | |
M extract_memeuse.awk | 10 +++++++--- | |
2 files changed, 8 insertions(+), 4 deletions(-) | |
--- | |
diff --git a/Makefile b/Makefile | |
t@@ -1,6 +1,6 @@ | |
log = ~/.irssi/log/Freenode/\#bitreich-en.log | |
-memeuse.tsv: extract_memeuse.awk $(log) | |
+memeuse.tsv: extract_memeuse.awk | |
awk -f extract_memeuse.awk $(log) > $@ | |
clean: | |
diff --git a/extract_memeuse.awk b/extract_memeuse.awk | |
t@@ -40,6 +40,7 @@ function extract_tag(s) { | |
match(s, /#.*/); | |
s = substr(s, RSTART, RLENGTH); | |
gsub(/ .*/, "", s); | |
+ gsub(/[!?,\.]$/, "", s); | |
return s; | |
} | |
t@@ -59,8 +60,11 @@ function extract_time(s) { | |
# find tag in current line | |
/ #[A-Za-z0-9]+/ { | |
if (! /< annna>/ && ! /#bitreich-en/) { | |
- printf("%s\t%s\-%s\-%s\t%s\t%s\t%s\n", | |
- n_days, year, month, day, | |
- extract_time($0), extract_user($0), extract_tag($0)… | |
+ tag = extract_tag($0); | |
+ if (!match(tag, "#nospoil")) { | |
+ printf("%s\t%s\-%s\-%s\t%s\t%s\t%s\n", | |
+ n_days, year, month, day, | |
+ extract_time($0), extract_user($0), tag); | |
+ } | |
} | |
} |