#!/bin/bash
awk '
{
print
split($2,a,"=")
ppid=a[2]
split($4,b,"=")
art=b[2]
sum[ppid]+=art
count[ppid]++
if (last_ppid != "" && last_ppid != ppid)
{
print "Average_Running_Children_of_ParentID=" last_ppid " is " sum_last/count_last
}
last_ppid=ppid
sum_last=sum[ppid]
count_last=count[ppid]
}
END {
if (last_ppid != "")
print "Average_Running_Children_of_ParentID=" last_ppid " is " sum[last_ppid]/count[last_ppid]
}
' result.txt > final.txt