May
14
2012

BASH Magic: Converting Username Lists Into A Usable Format

Share

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 jsmith@gmail.com. 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:

Smith, John@gmail.com

Doe, Jane@hotmail.com

Here is the output:

jsmith@gmail.com
jdoe@hotmail.com

I hope this helps you guys out.

 

Keep your hacks up and your head down.

 

~Connection

Share

Related Posts

About the Author:

Get Adobe Flash player