From b935a0b3e2c50db7caa82f275d1ba8ba143a03ba Mon Sep 17 00:00:00 2001 From: "Yann Esposito (Yogsototh)" Date: Thu, 17 Nov 2011 14:56:23 +0100 Subject: [PATCH] Write an abstract of tasks --- resume.awk | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100755 resume.awk diff --git a/resume.awk b/resume.awk new file mode 100755 index 0000000..ec98385 --- /dev/null +++ b/resume.awk @@ -0,0 +1,38 @@ +#!/usr/bin/awk -f +# number of minutes from str of hh:mm format +function minFromTime(str){ + h=str; + m=str; + gsub(/:.*$/,"",h); + gsub(/^.*:/,"",m); + return h*60+m; +} +# take a number of minutes, return a xh xxm format +function timeFromMin(time) { + m=time%60; + h=(time -m )/60; + if (m<10) { + m="0"m; + } + return h"h "m"m"; +} + +# get the name of the task +function message(){ + msg=$6; + for (i=7;i<=NF;i++) {msg=msg" "$i} + return msg; +} + +# For each line +{ + m=message() + time[m]=time[m]+minFromTime($5)-minFromTime($3); +} + +# Print the result +END { + for(i in time) { + print i"\t:\t"timeFromMin(time[i]); + } +}