Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

A bit fancier than my awk version

  awk -W interactive 'BEGIN { t = systime(); } { u=systime(); if (u - t > 1) { printf("= %s %ds =========\n",strftime("%T"), u - t); }; print $0; t = u; }'

Or if you want to clear the screen too

  awk -W interactive 'BEGIN { t = systime(); } { u=systime(); if (u - t > 1) { printf("\033[2J\033[H= %s %ds =========\n",strftime("%T"), u - t); }; print $0; t = u; }'


Just to maybe save someone a couple of seconds of time: the '-W interactive' bit is a mawk-specific option (-W is for implementation-specific options). Not 100% certain but it looks like the gawk default does something similar so no additional option is needed, I think.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: