C#
Программа берет строки из файла data ( без расширения )
и создает data-unique
для работу нужен .NET
using System;
using System.Collections.Generic;
using System.Text;
using System.IO;
namespace unique
{
class Program
{
static void Main(string[] args)
{
Encoding cp1251 = Encoding.GetEncoding(1251);
HashSet<string> hash = new HashSet</string><string>();
string line;
Console.Write("Read : ");
StreamReader file = new StreamReader(@"./data",cp1251);
while ((line = file.ReadLine()) != null)
{
hash.Add(line);
}
file.Close();
Console.Write("OKnWrite: ");
StreamWriter filew = new StreamWriter(@"./data-unique",false,cp1251);
foreach (String hval in hash)
{
filew.WriteLine(hval);
}
Console.Write("OKn");
}
}
}
</string>
Еще варианты Читать полностью »
О сайте