Skip to content

Commit

Permalink
readme code: fix
Browse files Browse the repository at this point in the history
  • Loading branch information
jarelllama authored Apr 19, 2024
1 parent 0eb4044 commit b37f9b9
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions functions/update_readme.sh
Original file line number Diff line number Diff line change
Expand Up @@ -264,15 +264,16 @@ sum() {
# Print dash if no runs for that day found
! grep -qF "$1" "$SOURCE_LOG" && { printf "-"; return; }

mawk "/${1},${2}/" "$SOURCE_LOG" | mawk '/,saved$/' | csvcut -c 5 \
# grep used here as mawk requires brackets to be escaped
grep -F "${1},${2}" "$SOURCE_LOG" | mawk '/,saved$/' | csvcut -c 5 \
| mawk '{sum += $1} END {print sum}'
}

# Function 'sum_excluded' is an echo wrapper that returns the percentage of
# excluded domains out of the raw count retrieved by the given source.
# $1: source to process (default is all sources)
sum_excluded() {
mawk "/$1/" "$SOURCE_LOG" > rows.tmp # Includes unsaved
grep -F "$1" "$SOURCE_LOG" > rows.tmp # Includes unsaved

raw_count="$(csvcut -c 4 rows.tmp | mawk '{sum += $1} END {print sum}')"
# Return if raw count is 0 to avoid divide by zero error
Expand Down

0 comments on commit b37f9b9

Please sign in to comment.