Sendmail Rewrite Ruleset

Hi all,

I like to write a rule which do the following:

INPUT ADDRESS REWRITTEN TO
----------------------------- -----------------------------
foo.bar@sub.domain.com bar@domain.com
foo@othersub.domain.com foo@domain.com

any idea?
this didn't work:
S99
R$-.$-@$* $:$2.$1@domain.com

I think you need multiple rules, so you can deal with the id and the host separately. First get any leading stuff off dotted names, then fet any subdomain off the domain. Remember that a Rewrite rule must stop matching or it runs forever.