(The component field here in bugzilla doesn't have "contrib" so I chose "bin".)
I don't know history of why the dostates toggle is there to not show the CPU: states "the first time". But this makes it so the batch view (like piped top to a file) excludes the CPU states and just has a blank line there.
Here is a simple fix (but maybe fix comment). Or maybe just get rid of "dostates".
--- contrib/top/top.c (revision 317435)
+++ contrib/top/top.c (working copy)
@@ -637,7 +637,7 @@
/* display the cpu state percentage breakdown */
- if (dostates) /* but not the first time */
+ if ((!interactive) || (dostates)) /* but not the first time */
(I originally saw this problem with pfSense's System Activity page while authoring a book about it.)