I want to edit ldif file with script in one short

ranju <[email protected]>
Newsgroups gmane.comp.lang.perl.modules.ldap
Organization http://groups.google.com
Message-ID <21c41d88-2e88-4844-9032-da100b1a8d54@w36g2000vbi.googlegroups.com>
here is the example for input file

dn: cn=462_9,ou=2013,ou=Month,o=Year
changetype: add
cn: 73001213
cn: 462_9

dn: cn=23_9,ou=2013,ou=Month,o=Year
changetype: add
cn: 72000097
cn: 23_9

dn: cn=487_9,ou=2013,ou=Month,o=Year
changetype: add
cn: 71000459
cn: 487_9

I need the output as same as this

dn: cn=462_9,ou=2013,ou=Month,o=Year
changetype: modrdn
newrdn: cn= 73001213
deleteoldrdn:1

dn: cn=23_9,ou=2013,ou=Month,o=Year
changetype: modrdn
newrdn: cn=72000097
deleteoldrdn:1

dn: cn=487_9,ou=2013,ou=Month,o=Year
changetype: modrdn
newrdn: cn= 71000459
deleteoldrdn:1


can some one please help me with the perl script......
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.