Hi, I am facing a problem with text file manipulation with Perl. I have a file with over 2 lac lines of data. I need to find the duplicates(strings) in the file and copy those records into another file. Is there a function/module in Perl by which I can read the duplicates in a file at one go and print them on to another file.
The following is a more detailed form of my requirement: The input to the code is a text file with the following format of records. dn: cn=1148734,ou=Employees,dc=jci,dc=com displayname: Herek, Moriah L jdirlastfourssn: 2888 dn: cn=1148735,ou=Employees,dc=jci,dc=com displayname: Pelletier, Michael J jdirlastfourssn: 8719 uid: cpellem dn: cn=1148736,ou=Employees,dc=jci,dc=com displayname: Manimanakis, Aris N jdirlastfourssn: 0366 dn: cn=1148738,ou=Employees,dc=jci,dc=com displayname: Bernardini, James A jdirlastfourssn: 8540 dn: cn=1148739,ou=Employees,dc=jci,dc=com displayname: Steyvers, Robert L jdirlastfourssn: 8634 dn: cn=1148740,ou=Employees,dc=jci,dc=com displayname: Vest, Elizabeth G jdirlastfourssn: 7487 The file will look like the above. What I need to do is: 1. Take the first entry and get the value of the display name attribute. 2. Check whether there is another record with the same display name attribute value.(There cud be multiple records) 3. If so then extract both record and write them into another file. 4. Delete these duplicate records from the parent file. 5. Do that for all records I hope you got what I meant. __________________________________ Do you Yahoo!? SBC Yahoo! DSL - Now only $29.95 per month! http://sbc.yahoo.com -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
