#!/usr/bin/perl my %buckets = (); my $highest = 0; my $lowest = 0; while (<>) { /^.\s+(-?\d+)\s+/ or next; $buckets{$1}++; if ($1 > $highest) { $highest = $1; } if ($1 < $lowest) { $lowest = $1; } } for my $i ($lowest..$highest) { my $count = $buckets{$i}; $count ||= 0; print "$i $count\n"; }