I’ve actually built a tool called Skifta that might suit your needs here. It’s made for anonymizing data in SQL dumps, like replacing emails, even when there are multiple per line, and it handles unique values to avoid conflicts. Might save you a lot of hassle! There is a built in transformer that's made for handling emails.