Skip to content

Instantly share code, notes, and snippets.

@guziy
Created November 30, 2018 14:06
Show Gist options
  • Save guziy/d600592fd641ebdd8077652a2f78ef64 to your computer and use it in GitHub Desktop.
Save guziy/d600592fd641ebdd8077652a2f78ef64 to your computer and use it in GitHub Desktop.
# Calculate an average time for a maestro task, using ksh and logs stored in the stats folder
grep surge_run *_avg | grep -P -o 'EXECTIME=\K\d+:\d+:\d+' | xargs -I % ksh -c 'h=$(echo % | cut -d ":" -f 1);m=$(echo % | cut -d ":" -f 2);s=$(echo % | cut -d ":" -f 3); echo $(((h * 3600 + m * 60 + s)/60.))' | awk 'BEGIN{s=0;}{s+=$1;}END{print s/NR;}'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment