There are a number of ways to do this, here is one.

 Code:
$="CN=James Doe,OU=Users,DC=something,DC=com"
$CN=right(split($,",")[0],-3)
? $CN
_________________________
(... better days ahead)