with parse_stats.awk

This commit is contained in:
AlexB1960
2026-08-31 21:20:10 +03:00
parent b5a6a110c3
commit b24e96bcd2

33
parse_stats.awk Executable file
View File

@@ -0,0 +1,33 @@
BEGIN {
total = 0
passed = 0
failed = 0
}
/^┌───────────────┬──────────────────────────┐$/ {
in_table = 1
next
}
in_table && /^│ Requests[[:space:]]+│/ {
if (match($0, /[0-9]+ \([0-9]+ Passed, [0-9]+ Failed\)/)) {
s = substr($0, RSTART, RLENGTH)
gsub(/[()]/, "", s)
split(s, parts, /[[:space:],]+/)
total = parts[1]
passed = parts[2]
failed = parts[4]
in_table = 0
}
}
in_table && /^└───────────────┴──────────────────────────┘$/ {
in_table = 0
}
END {
if (total == 0) {
print "WARNING: Could not parse stats from logs.txt" > "/dev/stderr"
}
printf "Total=%d, Passed=%d, Failed=%d\n", total, passed, failed
}