Skip to content

Instantly share code, notes, and snippets.

@dacarlin
Last active August 29, 2015 14:04
Show Gist options
  • Save dacarlin/a047d0845eafe3c3366a to your computer and use it in GitHub Desktop.
Save dacarlin/a047d0845eafe3c3366a to your computer and use it in GitHub Desktop.
Gets the number of jobs Terry's running on Epiphany
# part of the "You can bash that" series ...
qstat -u \* | awk '{print $4}' | tail -n +3 | uniq --count | awk '/teo/ {print $1}'
# and a (slightly) shorter way using only AWK (probably faster)
qstat -u \* | awk 'BEGIN {i = 0}; $NR > 3 && $4 ~ /teo/ {i++}; END {print i}'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment