删除不完全相同的重复项

时间:2013-10-16 18:32:50

标签: foxpro visual-foxpro

我试图清除“duplicates”(来自cmemails.csubject),即使它们在文件命名方面不相同。以下是相同的文件(文件名除外)。如何摆脱所有重复记录?我无法弄清楚如何比较这些电子邮件,更不用说删除重复的邮件了。

***ORIGINAL***  2013-10-07 - CHANGEMAN@MICROSOFT.COM - MS DEMAND MAINTENANCE NOTIFICATION -  TN049991 -21 OCT 2013 07-00 GMT.MSG
**DUPLICATE **  2013-10-07 - CHANGEMAN@MICROSOFT.COM - MS DEMAND MAINTENANCE NOTIFICATION -  TN049991 -21 OCT 2013 07-00 GMT - 1.MSG 
**DUPLICATE **  2013-10-07 - CHANGEMAN@MICROSOFT.COM - MS DEMAND MAINTENANCE NOTIFICATION -  TN049991 -21 OCT 2013 07-00 GMT - 99.MSG 
**DUPLICATE **  2013-10-07 - CHANGEMAN@MICROSOFT.COM - MS DEMAND MAINTENANCE NOTIFICATION -  TN049991 -21 OCT 2013 07-00 GMT - 401.MS

1 个答案:

答案 0 :(得分:0)

根据您提供的信息,您可以尝试这样的事情(第一个浏览显示四个记录,第二个浏览仅显示原始记录)。以下示例可以在命令窗口中运行以显示几个使用DELETE命令进行采样:

Set Deleted On
Create Cursor test (nrec i, cfile c(150))
Insert Into test Values (1,"***ORIGINAL***  2013-10-07 - CHANGEMAN@MICROSOFT.COM - MS DEMAND MAINTENANCE NOTIFICATION -  TN049991 -21 OCT 2013 07-00 GMT.MSG")
Insert Into test Values (2,"**DUPLICATE **  2013-10-07 - CHANGEMAN@MICROSOFT.COM - MS DEMAND MAINTENANCE NOTIFICATION -  TN049991 -21 OCT 2013 07-00 GMT - 1.MSG")
Insert Into test Values (3,"**DUPLICATE **  2013-10-07 - CHANGEMAN@MICROSOFT.COM - MS DEMAND MAINTENANCE NOTIFICATION -  TN049991 -21 OCT 2013 07-00 GMT - 99.MSG")
Insert Into test Values (4,"**DUPLICATE **  2013-10-07 - CHANGEMAN@MICROSOFT.COM - MS DEMAND MAINTENANCE NOTIFICATION -  TN049991 -21 OCT 2013 07-00 GMT - 401.MS")
Browse Last
Delete For Left(cfile,14)="**DUPLICATE **"
Browse Last
Recall All
Browse Last
Delete For "2013-10-07 - CHANGEMAN@MICROSOFT.COM - MS DEMAND MAINTENANCE NOTIFICATION -  TN049991" $ cfile And Left(cfile,14)<>"***ORIGINAL***"
Browse Last