#!/bin/sh
./miniruby -v

ls bug.*.txt|sed -e 's/[0-9]\+/*/'|sort|uniq -c | while read l; do
  echo "$l"
  files=$(echo "$l"|sed -e 's/.* \([^ ]*\)$/\1/')
  grep -h -A 2 "^#.*<signal handler called>" $files|
    ./miniruby -e 'loop do begin; STDIN.gets; print STDIN.gets.chomp, ", ", STDIN.gets; STDIN.gets; rescue IOError, NoMethodError; break; end end'|
    sed -e "s/([^()]*)/()/g" -e 's/\(#[0-9]\+ *\)0x[^ ]*/\1/g'|
    sort|
    uniq -c|
    sort -n|
    tac
done
