This is a little tricky, because it relies on an otherwise-useless terminating line for each buildstep.  This would need to change (perhaps to some method of "pushing" a line back into the input?) if you wanted to summarize steps where the first non-interesting line was otherwise useful.