Open pietrushnic opened 1 year ago
I think gawk
is the most common in distributions. But it may be a valid point.
Debian 11 I was using had mawk as default.
Another issue with syntax under mawk/awk:
+ awk '-F[;]' -v repo=coreboot '
/__COMMIT_START__/ {
getline
commit = $1
author = $2
date = $4
subject = $5
reviewed_on = ""
print "Commit: " commit, "Author: " author, "Date: " date, "Subject: " subject
getline
while ($0 != "__COMMIT_END__") {
if (match($0, /Reviewed-on: (.*)/, m)) {
reviewed_on = m[1]
}
getline
}
next
}
/files? changed/ {
if (match($0, /([0-9]+) insertion/, m)) insertions = m[1]
if (match($0, /([0-9]+) deletion/, m)) deletions = m[1]
printf "%s;%s;%s;%s;%s;%d;%d;%s\n", commit, author, date, repo, reviewed_on, insertions, deletions, subject
insertions = deletions = 0
reviewed_on = ""
}
'
awk: line 12: syntax error at or near ,
awk: line 17: syntax error at or near next
awk: line 20: syntax error at or near ,
awk: line 21: syntax error at or near ,
After installing gawk
default awk
was replaced, and now the script works as expected.
It looks like having the correct version of awk in the system is important:
If this kind of problem will be repeated by other users we should consider checking for awk version.