避免重复的行? [英] Avoiding duplicate lines?

查看:93
本文介绍了避免重复的行?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好。


我目前有2个文本文件,其中包含文件名列表。这些

文本文件由我的代码更新。我想要做的是能够将这些文本文件合并为丢弃重复项。


并使其更难(或不是??? !! )我定义

副本的标准是文件路径的左15个(或左右)字符。

一如既往,非常感谢帮助。如果你和我在一起,

我会给你买一杯饮料来感谢你!


谢谢

Hi all.

I currently have 2 text files which contain lists of file names. These
text files are updated by my code. What I want to do is be able to
merge these text files discarding the duplicates.

And to make it harder (or not???!!) my criteria for defining the
duplicate is the left 15 (or so) characters of the file path.
Help, as always, is greatly appreciated. And if you was here with me,
I would buy you a drink to thank you!

Thanks

推荐答案

不优雅但有效 -


您可以依次逐行读取每个文件到字符串中。

只有在字符串值的.binarysearch失败后才将字符串放入数组中。

然后,将数组流回到一个新文件。

读取每一个依次使用iostream进入数据集

< go ************ @ hotmail.com>在消息中写道

news:11 ********************** @ z14g2000cwz.googlegr oups.com ...
Not elegant but effective -

You could read each file in turn, line by line into a string.
Put the string into an array only after failing a .binarysearch for the string value.
Then, stream the array back out to a new file.
Read each one in turn into a dataset using an iostream
<go************@hotmail.com> wrote in message
news:11**********************@z14g2000cwz.googlegr oups.com...
大家好。

我目前有2个文本文件,其中包含文件名列表。这些
文本文件由我的代码更新。我想要做的是能够合并这些文本文件,丢弃重复项。

并使我更难(或不是??? !!)我的标准定义
duplicate是文件路径的左15(或左右)字符。

一如既往,非常感谢帮助。如果你和我在一起,
我会给你买一杯饮料来感谢你!

谢谢
Hi all.

I currently have 2 text files which contain lists of file names. These
text files are updated by my code. What I want to do is be able to
merge these text files discarding the duplicates.

And to make it harder (or not???!!) my criteria for defining the
duplicate is the left 15 (or so) characters of the file path.
Help, as always, is greatly appreciated. And if you was here with me,
I would buy you a drink to thank you!

Thanks






在我看来,只需要使用哈希表即可。

http://msdn.microsoft.com/library/de .. .ClassTopic.asp

我希望这有帮助吗?


Cor


< go * ***********@hotmail.com>
Hi,

In my opinion is a simple use of the hashtable all you need.

http://msdn.microsoft.com/library/de...ClassTopic.asp
I hope this helps?

Cor

<go************@hotmail.com>
大家好。

我目前有2个文本文件,其中包含文件列表名。这些
文本文件由我的代码更新。我想要做的是能够合并这些文本文件,丢弃重复项。

并使我更难(或不是??? !!)我的标准定义
duplicate是文件路径的左15(或左右)字符。

一如既往,非常感谢帮助。如果你和我在一起,
我会给你买一杯饮料来感谢你!

谢谢
Hi all.

I currently have 2 text files which contain lists of file names. These
text files are updated by my code. What I want to do is be able to
merge these text files discarding the duplicates.

And to make it harder (or not???!!) my criteria for defining the
duplicate is the left 15 (or so) characters of the file path.
Help, as always, is greatly appreciated. And if you was here with me,
I would buy you a drink to thank you!

Thanks





< go ************ @ hotmail.com>在消息中写道

news:11 ********************** @ z14g2000cwz.googlegr oups.com ...

<go************@hotmail.com> wrote in message
news:11**********************@z14g2000cwz.googlegr oups.com...
大家好。

我目前有2个文本文件,其中包含文件名列表。这些
文本文件由我的代码更新。我想要做的是能够合并这些文本文件,丢弃重复项。

并使我更难(或不是??? !!)我的标准定义
duplicate是文件路径的左15(或左右)字符。

一如既往,非常感谢帮助。如果你和我在一起,
我会给你买一杯饮料来感谢你!

谢谢
Hi all.

I currently have 2 text files which contain lists of file names. These
text files are updated by my code. What I want to do is be able to
merge these text files discarding the duplicates.

And to make it harder (or not???!!) my criteria for defining the
duplicate is the left 15 (or so) characters of the file path.
Help, as always, is greatly appreciated. And if you was here with me,
I would buy you a drink to thank you!

Thanks




和重复的帖子!!!! ;-)



And duplicate posts!!!! ;-)


这篇关于避免重复的行?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆