#!/usr/bin/env ruby statistics = {} ARGF.each_line do |line| type, n_columns, n_rows, round, runtime = line.split statistics[[type, n_columns, n_rows]] ||= [] statistics[[type, n_columns, n_rows]] << runtime end require "pp" statistics.each do |(type, n_columns, n_rows), runtimes| runtime_median = runtimes.sort[runtimes.size / 2] puts("#{type}\t#{n_columns}\t#{n_rows}\t#{runtime_median}") end