Created
October 15, 2015 22:53
-
-
Save michaelbarton/a44809fed31dcdf88010 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Needs bitly/data_hacks | |
pip install --user data_hacks |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -o pipefail | |
qhost \ | |
| egrep -v "^x|^uv|^mc1" \ | |
| tr -s ' ' \ | |
| cut -f 7 -d ' ' \ | |
| sed 's/0.00/free/' \ | |
| sed 's/[0-9].[0-9][0-9]/utilised/' \ | |
| egrep -v "\-|NLOAD" \ | |
| bar_chart.py --percentage |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Same result with less typing and fewer subprocesses:
qhost | awk 'NR>2 && !/^x|^uv|^mc1/ {if($7==0.00){print "free"} else {print "utilized"}}' | bar_chart.py --percentage