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

My favorite is piping stuff into awk to make bar graphs. Here's system load from atopsar for the current day:

  atopsar -p | tail -n +7 | grep '\S' | awk '{printf("\n%s %6.2f ",$1, $5); for (i = 0; i<$5; i++) {printf("")}}'; echo
sample: https://gist.github.com/defulmere/bec1aef40ca4cddb5c421ffa5f...



gracias


Dangit, there should have been an ASCII block character in that second printf. Here's a version with an asterisk instead:

  atopsar -p | grep ":[0-9]\{2\}\s\+[0-9]" | awk '{printf("\n%s %6.2f ",$1, $5); for (i = 0; i<$5; i++) {printf("*")}}'; echo




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

Search: