Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
Hi guys,
I hv to eliminiate the white spaces from following entry.
for eg:
uid=AdminCFT1, ou=adminaccount, o=xyz, dc=comIn above entry space is their after , (comma) [between uid= upto =com ]
First I hv to find which dn: entry has space & space is their them remove that space.I got 65000 entries.
=====================================
Entry examples:
=====================================
dn: uid=AdminCFT1, ou=adminaccount, o=xyz, dc=com
objectClass: AdminAccount
objectClass: simpleSecurityObject
objectClass: top
userPassword: {SSHA}m0//7Z5RH0CSP1UUecezLR5D8+jZAEspa0ZbCQ==
uid: ADMINCFT1dn: uid=AdminSCPM1, ou=adminaccount, o=xyz, dc=com
objectClass: top
objectClass: simpleSecurityObject
objectClass: AdminAccount
uid: ADMINSCPM1
userPassword: {CRYPT}9IWaaVNDcr1j.dn: uid=AdminCSC1, ou=adminaccount, o=xyz, dc=com
objectClass: simpleSecurityObject
objectClass: top
objectClass: AdminAccount
uid: ADMINCSC1
owner: uid=A611753,ou=account,o=xyz,dc=com
owner: uid=ZZ36784,ou=account,o=xyz,dc=com
userPassword: {SSHA}dn: uid=ownertoolkit,ou=adminaccount,o=xyz,dc=com
objectClass: top
objectClass: simpleSecurityObject
objectClass: AdminAccount
userPassword: {SSHA}TEKGInbR4dU50eWvZg0GBxO4DGJVMxAfYmcvPw==
uid: OWNERTOOLKIT

Here's a perl in-line edit command line "script" that will do it.
perl -pi -e 'if(/^dn:/i){s/,\s+/,/g'} script.file
if you what to create a backup file incase something goes wrong, change it to this:
perl -pi.bak -e 'if(/^dn:/i){s/,\s+/,/g'} script.file

![]() |
gawk syntax error
|
shellscript help
|

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |