Monday 15 September 2014

regex - Use sed to create email from old email -



regex - Use sed to create email from old email -

i have lot of emails changed first initial , lastly name

example: chris-lancer.chris@example.com

is possible take old email , replace

example: clancer@example.com

any help appreciated, thanks.

seems want this,

$ echo 'chris-lancer.chris@example.com' | sed 's/^\([a-z]\)[^-]*-\([^.]*\)\.[^@]*/\l\1\2/' clancer@example.com

or

$ echo 'example: chris-lancer.chris@example.com' | sed 's/^\(example: \)\([a-z]\)[^-]*-\([^.]*\)\.[^@]*/\1\l\2\3/' example: clancer@example.com

regex bash sed

No comments:

Post a Comment