Recently a buddy of mine was on a pentest and he saw a username list in the format of Smith, John@gmail.com and while this was all fine and dandy the emails were actually stored as firstname.lastname@example.org. I’ve encountered similar situations so I decided to code up a quick BASH oneliner to help him, myself and anyone else who encounters things like this in the future.
Command after the fold
cat FILE |sed -E 's/^(.*)\,.(.).*(\@.*)/\2\1\3/' |tr "[:upper:]" "[:lower:]"
Given the following sample data:
Here is the output:
I hope this helps you guys out.
Keep your hacks up and your head down.