#!/usr/bin/awk -f # $Id$ # This program is released under the GNU General Public License # You may find updates under http://www.jochen.org/ # Calculate the column name function column(col) { col = col - 1; rem = col % 26; div = col / 26; if ( div >= 1) { ret = sprintf("%c",64+div); } ret2 = sprintf("%c", 65+rem); return ret ret2 } # fill Excel cell with the runtime formula (end time - start time) function compute_runtime(run) { return "=" column(run*3) filenum+1 "-" column(run*3-1) filenum+1; } BEGIN { if ( regression_test == 1 ) { check_regression(); exit; } ok=0; run=0; file = ""; filenum=0; start=0; } # convert the date and time for Excel function format_date(dat) { return substr(dat,1,4) "-" substr(dat,5,2) "-" substr(dat,7,2) " " \ substr(dat,9,2) ":" substr(dat,11,2) ":" substr(dat,13,2); } function check_format_date() { } /^#START:/ { if ( file != FILENAME ) { run = 0; filenum = filenum + 1; printf "\r\n\"%s\";", FILENAME; file = FILENAME; } ok = 1; maybe_start = format_date($2); }; /^#STOP:/ { run = run + 1; if ( ok == 1 ) { ok = 0; printf "\"%s\";", maybe_start; maybe_start = ""; printf "\"%s\";\"%s\";", format_date($2), compute_runtime(run); }; }; END { print "\r\n"; }