Hi Guru's,
I need some help with data manipulation using shell scripting. I know how to replace the whole string but not part of the string.
The value after aa= should be replaced with the value in the mail leaving ,OU=111,OU=222,DC=333 as is. Below are the inputs and expected outputs.
Input:
dn: aa=XYZ,OU=111,OU=222,DC=333
mail: xyz@123.com
uid: xyz@123.com
sdf: aaa
dn: aa=abc,OU=111,OU=222,DC=333
mail: npr@123.com
uid: npr@123.com
sdf: www
dn: aa=def,OU=111,OU=222,DC=333
mail: def@123.com
uid: def@123.com
sdf: eee
dn: aa=ram,OU=111,OU=222,DC=333
mail: med@123.com
uid: med@123.com
sdf: qqq
output:
dn: aa=xyz@123.com,OU=111,OU=222,DC=333
mail: xyz@123.com
uid: xyz@123.com
sdf: aaa
dn: aa=npr@123.com,OU=111,OU=222,DC=333
mail: npr@123.com
uid: npr@123.com
sdf: www
dn: aa=def@123.com,OU=111,OU=222,DC=333
mail: def@123.com
uid: def@123.com
sdf: eee
dn: aa=med@123.com,OU=111,OU=222,DC=333
mail: med@123.com
uid: med@123.com
sdf: qqq
Thanks in advance,
Sam