Re: Parse x.500 DN and change order displayed



On Mar 31, 8:26 am, Hallvard B Furuseth <h.b.furus...@xxxxxxxxxxx>
wrote:
SecureIT writes:
I am trying to change this
"cn=Bob Smith+serialNumber=CR013120080827,o=ICM,c=US"
to this:
"serialNumber=CR013120080827+cn=Bob Smith,o=ICM,c=US"

Without escape sequences like "\," and "\+" in the DNs (if that's
allowed anyway, I don't remember the details of X.500 Dn syntax), this
moves serialNumber first in each RDN:

s/(^|,)([^,]*)\+(serialNumber=[^+,]*)(?=[+,])/$1$3+$2/gi;
die "didn't catch all 'foo+serialNumber's" if /\+serialNumber=/i;

--
Hallvard

That worked great, thanks so much. Just ran it and all 2000 DN's are
properly formatted now.

-G
.