Skip to content

Instantly share code, notes, and snippets.

@jonasc
Last active August 29, 2015 14:16
Show Gist options
  • Save jonasc/95dbe84a98a4d3de6bd7 to your computer and use it in GitHub Desktop.
Save jonasc/95dbe84a98a4d3de6bd7 to your computer and use it in GitHub Desktop.
#!/bin/bash
if [[ $1 == -n ]]; then
file=$2
proc=$3
shift 3
spin $@ -run -d "$file" | sed --silent "/^\(proctype \)\?$proc/,/^\S\|^$/p" | awk '{print $1 " " $2}' | grep '^state' | sort -n | uniq | wc -l
else
file=$1
proc=$2
shift 2
spin $@ -run -d "$file" | sed --silent "/^\(proctype \)\?$proc/,/^\S\|^$/p" | awk '{print $1 " " $2}' | grep '^state' | sort -n | uniq
fi
#!/bin/bash
if [[ $1 == -n ]]; then
spin -run -d "$2" | sed --silent "/^\(proctype \)\?$3/,/^\S\|^$/p" | head --lines=-2 | wc -l
else
spin -run -d "$1" | sed --silent "/^\(proctype \)\?$2/,/^\S\|^$/p" | head --lines=-1
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment