Hi, i need help for parsing user data exported from Active Directory using csvde tool. This tool generate a csv export file where one column proxyAddresses contains multiple values like this:
smtp:Martin.Mueller@cde.org;x500:/O=WGR/OU=DE-ABCSOMMERLAND-01/cn=Reci +pients/cn=J63042;X500:/o=CKAG/ou=FIL/cn=Recipients/cn=J63042;X400:c=D +E;a= ;p=CKAG;o=FIL;s=Mueller;g=Martin;;SMTP:Martin.Mueller@acme.net;s +mtp:J63042@acme.net;MRS:J63042@FIL.ckag.mrs
This value represent different addresses of the user used by Exchange server for different connections (e.g. smtp). Every single address
I need to separate this values. The problem i have is the x400 address which consists of multiple parts which are also divided by an ";"!
I tried to split using split ';' $field which works fine but also splits the X400 address to it's parts which is correct. I also tried to split using a beginning sequence split/(MRS|mrs|smtp|SMTP|[xX][45]00):/ $field to get a list of all services and their values but this gives me a list starting with an empty value followed by a first service name followed by a first service address...
Could you explain please how to get list of elements which contains one complete entry per line e.g.
#use Modern::Perl; use strict; user warnings; use Data::Dumper; my @fields = ( 'smtp:Martin.Mueller@cde.org;x500:/O=WGR/OU=DE-ABCSOMM +ERLAND-01/cn=Recipients/cn=J63042;X500:/o=CKAG/ou=FIL/cn=Recipients/c +n=J63042;X400:c=DE;a= ;p=CKAG;o=FIL;s=Mueller;g=Martin;;SMTP:Martin.M +ueller@acme.net;smtp:J63042@acme.net;MRS:J63042@FIL.ckag.mrs', 'smtp:Olga.Muster@cde.org;x500:/O=WGR/OU=DE-ABCSOMMERL +AND-01/cn=Recipients/cn=J68392;X500:/o=CKAG/ou=FIL/cn=Recipients/cn=J +68392;X400:c=DE;a= ;p=CKAG;o=FIL;s=Muster;g=Olga;;SMTP:Olga.Muster@ac +me.net;smtp:J68392@acme.net;MRS:J68392@FIL.CKAG.mrs', 'smtp:j12345@acme.net;smtp:Alex.Kaiser@cde.org;MRS:j12 +345@FIL.ckag.mrs;SMTP:Alex.Kaiser@acme.net;X400:c=DE;a= ;p=CKAG;o=FIL +;s=Kaiser;g=Alex;', 'smtp:Joseph.Mann@cde.org;x500:/O=WGR/OU=DE-ABCSOMMERL +AND-01/cn=Recipients/cn=J68355;X500:/o=CKAG/ou=FIL/cn=Recipients/cn=J +68355;X400:c=DE;a= ;p=CKAG;o=FIL;s=Mann;g=Joseph;;SMTP:Joseph.Mann@ac +me.net;smtp:J68355@acme.net;MRS:J68355@FIL.CKAG.mrs', ); foreach my $value (@fields) { print "$value\n"; print Dumper(split (';', $value)); print "\n"; } foreach my $value (@fields) { print "$value\n"; print Dumper(split (/(MRS|mrs|smtp|SMTP|[xX][45]00):/, $value)); print "\n"; }
In reply to Parse proxyAddresses field of csvde export by wwe
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |