This question already has an answer here:
I have some emails where I would like to mask all characters except the last 2 before the @ sign and mask everything after that.
So far, using
perl, I tried:
perl -pe 's/(<.)(.*)(@.)(.*)(.\..*>)/$1."*" x length($2).$3."*" x length($4).$5/e'
but it is not giving the intended results.