Ryan Simpkins wrote: > On Wed, March 14, 2007 14:08, Will McDonald wrote (trimmed): >> On 14/03/07, Ryan Simpkins <centos at ryansimpkins.com> wrote: >>> Try doing a simple 'cat /var/log/maillog | grep -c check_relay' >> You can avoid the unnecessary 'cat' by just passing the filename to grep directly: >> >> # grep -c 'checK_relay.*spamhaus' /var/log/maillog >> # grep -c 'checK_relay.*spamcop' /var/log/maillog >> # grep -c 'checK_relay.*njabl' /var/log/maillog >> >> Would probably be more efficient and faster, you can test with 'time' to verify > this. You're spawning one process 'grep', instead of three seperate processes, > 'cat, 'grep' and 'grep' again. > > Am I using time right to measure it? No, you're timing the cat only. > > # time cat /var/log/maillog | grep check_relay | grep -c njabl > 8 > > real 0m0.299s > user 0m0.289s > sys 0m0.009s > Too short for useful measurement with these tools. -- Cheers John -- spambait 1aaaaaaa at coco.merseine.nu Z1aaaaaaa at coco.merseine.nu Please do not reply off-list