Yeah, I know, I should have used 'awk' for this. Sue me. It's been too long since I did awk state machines. There's a reason there's a "git grep" but not a "git awk" command.
http://article.gmane.org/gmane.linux.kernel/2223188