Q: Hybris Delete Duplicate Product Data Anyone knows how to create a code to delete duplicate product data in Hybris? either using an impex script or modifying the code?

A: 
Question: How to delete Hybris Products having a duplicate name?

You can run SQL / flexible query to find duplicate products and then delete those list of pk using SQL query.
List of pks to be removed
select MIN({p.pk}) as pks
 from {Product! as p

 JOIN CatalogVersion as CV on {p.catalogversion}={CV:PK} and {CV:version} = 'Online' 
 JOIN Catalog as C on {CV:catalog}={C:PK} and {C:id}='myProductCatalog'
 } 
 group by {p:name}
 having 
   count(*) > 1


Run the remove query
Remove all pks get from above query. Repeat this for the Online version as well.

You can find detail steps here

A: First of all, find the duplicated CMSItems using following flexiblesearch
SELECT {UID} as uid,{CatalogVersion} as CatalogVersion , count(1) as cnt from {CMSItem} GROUP BY {UID},{CatalogVersion} HAVING COUNT(1) > 1

then delete the duplicated ones.
