Нашел на просторах интернета интересный скрипт, который борется с большим массивом данных текста. А точнее удаляет дубли в ключевых словах. Возможно стоит подправить для работоспобности, но в целом работает шустро и аккуратно. Вот код, нужно засунуть его в бат файл:
/*
@echo off && cls
set WinDirNet=%WinDir%\Microsoft.NET\Framework
IF EXIST "%WinDirNet%\v2.0.50727\csc.exe" set csc="%WinDirNet%\v2.0.50727\csc.exe"
IF EXIST "%WinDirNet%\v3.5\csc.exe" set csc="%WinDirNet%\v3.5\csc.exe"
IF EXIST "%WinDirNet%\v4.0.30319\csc.exe" set csc="%WinDirNet%\v4.0.30319\csc.exe"
%csc% /nologo /out:"%~0.exe" %0
"%~0.exe" %1
del "%~0.exe"
exit
*///14 mar 2015 @ 13:29
//metaspamer.blogspot.comusing System;
using System.Collections.Generic;
using System.IO;
using System.Text;namespace spicemustflow_sortcleaner
{
class Program
{
static string GetFilename(string nameWithoutExtension, bool uniq)
{
int n = 1;
string outputFile = string.Empty;
while (true)
{
outputFile = string.Format("{0}_{1}{2}.txt",
nameWithoutExtension, uniq ? "uniques" : "duplicates",
n > 1 ? n.ToString() : string.Empty);
if (File.Exists(outputFile)) n++;
else break;
}
return outputFile;
}static void Main(string[] args)
{
string path = Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location) + "\\";
string[] filelist = null;
if (args.Length == 0) filelist = Directory.GetFiles(path, "*.txt", SearchOption.TopDirectoryOnly);
else filelist = args;foreach (string filename in filelist)
{
Encoding enc = Encoding.Default;
using (FileStream fs = File.OpenRead(filename))
{
byte[] data = new byte[3];
while (fs.Read(data, 0, data.Length) > 0)
if (data[0] == 0xef && data[1] == 0xbb && data[2] == 0xbf)
{
enc = Encoding.UTF8;
break;
}
else
{
enc = Encoding.GetEncoding(1251);
break;
}
}Console.Write("loading {0}..\n", filename);
string[] input = File.ReadAllLines(filename, enc);
if (input.Length > 0)
{
Console.Write("sorting..\n");
Array.Sort(input);
List<string> uniques = new List<string>();
List<string> duplicates = new List<string>();
Console.Write("deleting duplicates..\n");
uniques.Add(input[0]);
for (int i = 1; i < input.Length; i++)
if (input[i] != input[i — 1])
uniques.Add(input[i]);
else
duplicates.Add(input[i]);Console.Write("\nsaving..\n");
File.WriteAllLines(path + GetFilename(Path.GetFileNameWithoutExtension(filename), true), uniques.ToArray(), enc);
File.WriteAllLines(path + GetFilename(Path.GetFileNameWithoutExtension(filename), false), duplicates.ToArray(), enc);
Console.Write("\n\n");
}
}
}
}
}
________________
Технологии совершают прорыв. Теперь макет дома или схему расположения предметов в квартире можно распечатать на принтере. Для этого нужно купить 3д принтер в Москве и нарисовать объемную модель в любом векторном редакторе типа компаса 3д. Результат впечатляет – можно пощупать руками, переместить стены, внести доработки непосредственно в модель.