Hi; I have a command to obtain all the groups a user is part of. The command is: dsquery user domainroot -samid <user name> | dsget user -memberof - expand The output is: "CN=Domain Users,CN=Users,DC=testdc,DC=testroot,DC=test,DC=com" "CN=DA-C3-AB-AB1-SERVER-DATA-CHANGE,OU=ACL_Groups,OU=Groups,OU=ABC,DC= testdc,DC=testroot,DC=test,DC=com" I need to obtain the group name From after CN= until the first comma. I tried scan and match. I can't get it right.