Re: Parse x.500 DN and change order displayed

Re: Parse x.500 DN and change order displayed

am 31.03.2008 18:20:48 von SecureIT

On Mar 31, 8:26=A0am, Hallvard B Furuseth
wrote:
> SecureIT writes:
> > I am trying to change this
> > "cn=3DBob Smith+serialNumber=3DCR013120080827,o=3DICM,c=3DUS"
> > to this:
> > "serialNumber=3DCR013120080827+cn=3DBob Smith,o=3DICM,c=3DUS"
>
> 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=3D[^+,]*)(?=3D[+,])/$1$3+$2/gi ;
> die "didn't catch all 'foo+serialNumber's" if /\+serialNumber=3D/i;
>
> --
> Hallvard

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

-G