Perl 展开ldifde输出文件
我正在使用ldifde导出一个模式,但是输出文件包装了很长的行,因此很难使用千行进行手动编辑 我必须编辑该文件,因为我必须替换其中的字符串,例如:Perl 展开ldifde输出文件,perl,active-directory,ldif,Perl,Active Directory,Ldif,我正在使用ldifde导出一个模式,但是输出文件包装了很长的行,因此很难使用千行进行手动编辑 我必须编辑该文件,因为我必须替换其中的字符串,例如: distinguishedName: CN=xxx-com-Admin-Assistant-yy,CN=Schema,CN=Configuration,-->DC=morel,DC=mis,DC=mo r-ambiguit,<--DC=com 区分名称: CN=xxx com管理员助理yy,CN=Schema,CN=Configu
distinguishedName:
CN=xxx-com-Admin-Assistant-yy,CN=Schema,CN=Configuration,-->DC=morel,DC=mis,DC=mo
r-ambiguit,<--DC=com
区分名称:
CN=xxx com管理员助理yy,CN=Schema,CN=Configuration,-->DC=morel,DC=mis,DC=mo
r-ambiguit,DC=myDomain,如果您严格希望使用LDIFDE将架构从一个域导入到另一个域,可以使用LDIFDE中的-c
参数将一个DN更改为另一个DN,请参阅
如果严格希望使用LDIFDE将架构从一个域导入到另一个域,可以使用LDIFDE中的-c
参数将一个DN更改为另一个DN,请参阅
@dgw c:\Perl64\bin>perl-p-e“BEGIN{$/=undf}s/\n(?=[a-z])///g”测试。ldf@dgwc:\Perl64\bin>perl-p-e“s/\n//g”test.ldfan和-->
您试图用该perl正则表达式删除DC=morel,DC=mis,DC=mor歧义,
?这应该如何工作?@dgw谢谢,您的脚本运行得很好。@dgw c:\Perl64\bin>perl-p-e“BEGIN{$/=undf}s/\n(?=[a-z])///g”测试。ldf@dgwc:\Perl64\bin>perl-p-e“s/\n//g”test.ldfan和-->
您试图用该perl正则表达式删除DC=morel,DC=mis,DC=mor歧义,
?这应该是怎么回事?@dgw谢谢,你的脚本运行得很好。
distinguishedName:
CN=xxx-com-Admin-Assistant-yy,CN=Schema,CN=Configuration,-->DC=myDomain,<--DC=com
#!/usr/bin/perl
use strict ;
my $orig = do { local $/ ; <DATA> } ;
( my $copy = $orig ) =~ s/(DC=)(.+?)(,DC=com)/$1myDomain$3/xsg ;
printf "Before:\n%s\nAfter:\n%s\n" , $orig , $copy ;
__DATA__
distinguishedName:
CN=xxx-com-Admin-Assistant-yy,CN=Schema,CN=Configuration,DC=morel,DC=mis,DC=mo
r-ambiguit,DC=com
Before:
distinguishedName:
CN=xxx-com-Admin-Assistant-yy,CN=Schema,CN=Configuration,DC=morel,DC=mis,DC=mo
r-ambiguit,DC=com
After:
distinguishedName:
CN=xxx-com-Admin-Assistant-yy,CN=Schema,CN=Configuration,DC=myDomain,DC=com
-c FromDN ToDN Replace occurrences of FromDN to ToDN