Regular Expressions
Problem:
You want to monitor which users are currently logging into imap in real time.
Solution:
Tail the file and print out the user (happens to be the 7th space-separated field) logging into IMAP
Sample line:
Apr 11 20:35:34 napoleon imapd-ssl: LOGIN, user=greenfly, ip=[::ffff:192.168.0.11]

Parser:
[]$ tail -f /var/log/mail.log \
    | perl -ne 'print scalar((split)[6]),"\n" if(/imapd.*LOGIN/);'
Tux the Linux Penguin.