part1: tweak the format strings so that numbers never run together. If, for example, your blocked process count hits double digits, it smears into the next column, which then makes the rest of the output unparseable by scripts. The alignment is then a little off, but I'll take hard to read over impossible to read anyday.
part2: do not print the banner if it's not a tty. If you're piping the output, the receiver probably doesn't want to see it. Index: vmstat.c =================================================================== RCS file: /home/tedu/cvs/src/usr.bin/vmstat/vmstat.c,v retrieving revision 1.113 diff -u -r1.113 vmstat.c --- vmstat.c 27 Oct 2009 23:59:49 -0000 1.113 +++ vmstat.c 16 Nov 2009 01:15:07 -0000 @@ -390,11 +390,11 @@ warn("could not read vm.vmmeter"); bzero(&total, sizeof(total)); } - (void)printf("%2u%2u%2u", + (void)printf(" %u %u %u ", total.t_rq - 1, total.t_dw + total.t_pw, total.t_sw); #define rate(x) ((((unsigned)x) + halfuptime) / uptime) /* round */ #define pgtok(a) ((a) * ((unsigned int)uvmexp.pagesize >> 10)) - (void)printf("%7u %7u ", + (void)printf("%6u %7u ", pgtok(total.t_avm), pgtok(total.t_free)); (void)printf("%4u ", rate(uvmexp.faults - ouvmexp.faults)); (void)printf("%3u ", rate(uvmexp.pdreact - ouvmexp.pdreact)); @@ -427,6 +427,10 @@ printhdr(void) { int i; + static int printedhdr; + + if (printedhdr && !isatty(STDOUT_FILENO)) + return; (void)printf(" procs memory page%*s", 20, ""); if (ndrives > 0) @@ -445,6 +449,7 @@ dr_name[i][strlen(dr_name[i]) - 1]); (void)printf(" int sys cs us sy id\n"); hdrcnt = winlines - 2; + printedhdr = 1; } /*