handle some edge cases and merge the two awk invocations - annna - Annna the ni… | |
git clone git://bitreich.org/annna/ git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws6… | |
Log | |
Files | |
Refs | |
Tags | |
README | |
--- | |
commit 6b492185fa1670b4208bad4530428eba11d2ce95 | |
parent 289cc398a0f12633630239246ed6c134372ce8a1 | |
Author: Josuah Demangeon <[email protected]> | |
Date: Tue, 9 Feb 2021 22:13:40 +0100 | |
handle some edge cases and merge the two awk invocations | |
The line "#_E_#D,G,Y,.. #.T_Ag5..." gathers "#_E_", "#D" and "#.T_Ag5" | |
Signed-off-by: Annna Robert-Houdin <[email protected]> | |
Diffstat: | |
M annna-start-services | 19 +++++++++---------- | |
1 file changed, 9 insertions(+), 10 deletions(-) | |
--- | |
diff --git a/annna-start-services b/annna-start-services | |
@@ -706,16 +706,15 @@ annna_common() { | |
done | |
else | |
printf '%s' "$text" | awk -v taglimit="$printnhashtags" ' | |
- $0 ~ /#/ && $0 !~ /#nospoil/ { | |
- for (i = 1; i <= NF; i++) | |
- if (match($i, /#[^ '"'"',?!$\001]*/)) | |
- tags[j++] = substr($i, RSTART, RLENGTH) | |
- } | |
- END { | |
- for (tag in tags) | |
- if (k++ < taglimit) | |
- print tags[tag] | |
- }' | awk '!a[$0]++' | while read -r tag; | |
+ $0 !~ /#nospoil/ { | |
+ while (match($0, /#[^# "'\'',?!$\001]+/)) { | |
+ tag = substr($0, RSTART, RLENGTH) | |
+ $0 = substr($0, RSTART + RLENGTH) | |
+ sub(/[.]*$/, "", tag) | |
+ if (!uniq[tag]++ && taglimit-- > 0) | |
+ print tag | |
+ } | |
+ }' | while read -r tag; | |
do | |
if tagline="$(grep "${tag} " "${hashtagfile}")"; | |
then |