#!/usr/bin/awk -F
/chip drivers\/i2c/ {
i=0
lines[i++]=$0
is_touch=0
is_wake=0
#print FILENAME
#print
next
}
{
if (i == 0)
next
# print
lines[i++]=$0
if (tolower($0) ~ /touchpad/)
is_touch=1
if (tolower($0) ~ /wake/)
is_wake=1
}
/^\s*end/ {
if (i == 0)
next
if (is_touch == 0) {
i=0
next
}
total_touch+=1
if (is_wake)
total_wake+=1
if (is_wake) {
i=0
next
}
print FILENAME
print is_touch
for (x = 0; x < i; x++)
print lines[x]
i=0
}
END {
print "Total Touchpad: " total_touch
print "Total Wake: " total_wake
}