A tiny piece of SQL to update email addresses in a table where the domain is changing:
update aliases set emailaddr = concat(SUBSTRING_INDEX(emailaddr, '@', 1), '@newdomain.com') where emailaddr like '%@olddomain.com';
Very simple, but this has been hanging around in draft for ages and it may help someone.