use strict; my %space; while (<>) { next unless m#^/#; next if m#^/proc#; next unless m#^[^ ]* *([^ ]*) *[^ ]* *([^ ]*) *[^ ]*#; $space{$ARGV}{total} += $1; $space{$ARGV}{free} += $2; } foreach my $host (sort keys %space) { printf "%s: %dk free, out of %dk, (%.2f%%)\n", $host, $space{$host}{free}, $space{$host}{total}, $space{$host}{free} / $space{$host}{total} * 100; }