Skip to content

Instantly share code, notes, and snippets.

@kyleterry
Created September 25, 2013 18:47
Show Gist options
  • Save kyleterry/6704178 to your computer and use it in GitHub Desktop.
Save kyleterry/6704178 to your computer and use it in GitHub Desktop.
if [ ! ${#} -eq 2 ]; then
echo "Usage: ${0} deploy_20130101.txt (APPROVED|PENDING|FAILED)"
exit 1
fi
DEPLOY_FILE=${1}
STATUS=${2}
i=0
lines=$(wc -l ${DEPLOY_FILE} | awk '{print $1}')
total_groups=$(($lines / 6))
echo "Searching through ${total_groups} tickets"
for i in $(seq 1 6 ${lines})
do
ticket_data=$(tail -n +${i} ${DEPLOY_FILE} | head -n 6)
ticket_state=$(echo "${ticket_data}" | grep -i state: | awk '{print $2}')
if [ "${ticket_state}" == "${STATUS}" ]; then
echo "${ticket_data}"
fi
done
@parhamr
Copy link

parhamr commented Oct 31, 2013

:)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment