#!/usr/bin/perl -w if ($#ARGV < 0) { print "Usage: $0 threshold\n"; print " Prints a quota report listing each user over threshold\n"; print " precent of their mail quota.\n"; exit; } $threshold = $ARGV[0]; open(IN, "su cyrus -c '/usr/local/cyrus/bin/quota' |") or die("Could not execute Cyrus quota command"); while() { if (/\d+\s+(\d+)\s+\d+\s+user\.\w+/) { $percent = $1; if ($percent >= $threshold) { print; } } else { # Print anything that doesn't match the above RE print; } } close(IN);