Поскольку input.log является вашим вводом, у меня есть это, которое работает с gawk, все еще пытаюсь выяснить это с awk:
cat input.log |
gawk -F"|" \
#print the header
'BEGIN{print"Type, Number,ID,submitted,notsubmitted"}
#only work on non empty lines
NF>0{
#create an ID from the first three fields
n=$1","$2","$3;
#everytime the ID pops up, increment subindex 1 or 2 depending on the value of field 4
if($4=="S:1"){
array[n][2]++}
else{
array[n][1]++}
}
#print the final array
END{for(i in array){
#if the value has never been seen declare it to be zero
if(array[i][1]){
m=array[i][1]}
else {
m=0}
if(array[i][2]){
n=array[i][2]}
else {
n=0}
print i","m","n}
}'