<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[Серый форум &mdash; AHK: Удаление одинаковых строк из файла №2, содержащихся в файле №1]]></title>
	<link rel="self" href="http://forum.script-coding.com/extern.php?action=feed&amp;tid=10077&amp;type=atom" />
	<updated>2018-05-08T21:34:51Z</updated>
	<generator>PunBB</generator>
	<id>http://forum.script-coding.com/viewtopic.php?id=10077</id>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Удаление одинаковых строк из файла №2, содержащихся в файле №1]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=125255#p125255" />
			<content type="html"><![CDATA[<p>В коде результат идет не в файл, а в переменную res.<br />Идёт 2 цикла, в начале каждого цикла переменная res обнуляется.<br /></p><div class="codebox"><pre><code>SetBatchLines -1
file1 =
(
SetWorkingDir, %A_ScriptDir%
If !ErrorLevel MsgBox
Tooltip,Sleep,900
)
file2 =
(
If !ErrorLevel MsgBox
Tooltip,Sleep,900
Tooltip
)

loop 2
{
   res := &quot;&quot;
   If A_Index = 1
      a := file1, b := file2
   Else
      a := file2, b := file1
   obj := []
   loop, parse, a, `n, `r
      obj[A_LoopField] := 1
   loop, parse, b, `n, `r
      res .= !obj[A_LoopField] ? (res?&quot;`n&quot;:&quot;&quot;) A_LoopField : &quot;&quot;
   out%A_Index% := res
}
msgbox % out1
msgbox % out2</code></pre></div>]]></content>
			<author>
				<name><![CDATA[Malcev]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=26930</uri>
			</author>
			<updated>2018-05-08T21:34:51Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=125255#p125255</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Удаление одинаковых строк из файла №2, содержащихся в файле №1]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=125254#p125254" />
			<content type="html"><![CDATA[<p>Сложность в том, что так весь результат опять идёт в один файл, а мне надо в два.</p>]]></content>
			<author>
				<name><![CDATA[DD]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=25263</uri>
			</author>
			<updated>2018-05-08T21:11:46Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=125254#p125254</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Удаление одинаковых строк из файла №2, содержащихся в файле №1]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=125229#p125229" />
			<content type="html"><![CDATA[<p>А в чём сложность?<br /></p><div class="codebox"><pre><code>SetBatchLines -1
file1 =
(
SetWorkingDir, %A_ScriptDir%
If !ErrorLevel MsgBox
Tooltip,Sleep,900
)
file2 =
(
If !ErrorLevel MsgBox
Tooltip,Sleep,900
Tooltip
)

loop 2
{
   res := &quot;&quot;
   If A_Index = 1
      a := file1, b := file2
   Else
      a := file2, b := file1
   obj := []
   loop, parse, a, `n, `r
      obj[A_LoopField] := 1
   loop, parse, b, `n, `r
      res .= !obj[A_LoopField] ? (res?&quot;`n&quot;:&quot;&quot;) A_LoopField : &quot;&quot;
   msgbox % res
}</code></pre></div>]]></content>
			<author>
				<name><![CDATA[Malcev]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=26930</uri>
			</author>
			<updated>2018-05-08T18:16:38Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=125229#p125229</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Удаление одинаковых строк из файла №2, содержащихся в файле №1]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=125227#p125227" />
			<content type="html"><![CDATA[<p>Вот пример —<br /></p><div class="codebox"><pre><code>
SetBatchLines -1
file1 =
(
   SetWorkingDir, %A_ScriptDir%
   If !ErrorLevel MsgBox
   Tooltip,Sleep,900
)
file2 =
(
   If !ErrorLevel MsgBox
   Tooltip,Sleep,900
   Tooltip
)
loop 2
{
res := &quot;&quot;
   If A_Index = 1
      a := file1, b := file2
   Else
      a := file2, b := file1
   obj := []
   loop, parse, a, `n, `r
      obj[A_LoopField] := 1
   loop, parse, b, `n, `r
      res .= !obj[A_LoopField] ? (res?&quot;`n&quot;:&quot;&quot;) A_LoopField : &quot;&quot;
}
msgbox % file1
msgbox % file2
</code></pre></div><p>Надо бы, чтоб вышло два вывода, с уникальным содержимым для file1 и file2. Для file1 — это строка &quot;SetWorkingDir, %A_ScriptDir%&quot;, а для file2 — строка &quot;Tooltip&quot;.</p>]]></content>
			<author>
				<name><![CDATA[DD]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=25263</uri>
			</author>
			<updated>2018-05-08T17:05:35Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=125227#p125227</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Удаление одинаковых строк из файла №2, содержащихся в файле №1]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=125209#p125209" />
			<content type="html"><![CDATA[<p>Пример приведите файлов и результат.</p>]]></content>
			<author>
				<name><![CDATA[Malcev]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=26930</uri>
			</author>
			<updated>2018-05-08T07:01:52Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=125209#p125209</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Удаление одинаковых строк из файла №2, содержащихся в файле №1]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=125207#p125207" />
			<content type="html"><![CDATA[<p>Тоже не выходит. Мне надо развести разницу в два файла по такому типу —<br /></p><div class="codebox"><pre><code>SetBatchLines -1
FileRead, file1, 1.txt
FileRead, file2, 2.txt
loop 2
{
res := &quot;&quot;
   If A_Index = 1
      a := file1, b := file2
   Else
      a := file2, b := file1
   obj := []
   loop, parse, a, `n, `r
      obj[A_LoopField] := 1
   loop, parse, b, `n, `r
      res .= !obj[A_LoopField] ? (res?&quot;`n&quot;:&quot;&quot;) A_LoopField : &quot;&quot;
}
fileappend % obj, %a_desktop%/1.txt
fileappend % res, %a_desktop%/2.txt</code></pre></div>]]></content>
			<author>
				<name><![CDATA[DD]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=25263</uri>
			</author>
			<updated>2018-05-08T05:14:13Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=125207#p125207</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Удаление одинаковых строк из файла №2, содержащихся в файле №1]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=125199#p125199" />
			<content type="html"><![CDATA[<p>После &quot;loop 2&quot; вставьте res := &quot;&quot;.</p>]]></content>
			<author>
				<name><![CDATA[Malcev]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=26930</uri>
			</author>
			<updated>2018-05-07T20:12:20Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=125199#p125199</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Удаление одинаковых строк из файла №2, содержащихся в файле №1]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=125187#p125187" />
			<content type="html"><![CDATA[<p>Понял, что там условие. Но как развести разницу в два файла, а не объединять её?</p>]]></content>
			<author>
				<name><![CDATA[DD]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=25263</uri>
			</author>
			<updated>2018-05-07T17:44:56Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=125187#p125187</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Удаление одинаковых строк из файла №2, содержащихся в файле №1]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=125176#p125176" />
			<content type="html"><![CDATA[<p>Нужно почитать про тернарные операторы и изменить эту строчку:<br /></p><div class="codebox"><pre><code>res .= !obj[A_LoopField] ? (res?&quot;`n&quot;:&quot;&quot;) A_LoopField : &quot;&quot;</code></pre></div>]]></content>
			<author>
				<name><![CDATA[Malcev]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=26930</uri>
			</author>
			<updated>2018-05-07T09:08:48Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=125176#p125176</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Удаление одинаковых строк из файла №2, содержащихся в файле №1]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=125173#p125173" />
			<content type="html"><![CDATA[<p>Как можно было бы изменить последний код из поста №23, чтобы уникальные строки каждого файла не объединялись в новый, а перезаписывались в обрабатываемые файлы, либо переносились в новые файлы — под теми же именами — в другое место?<br /></p><div class="codebox"><pre><code>
SetBatchLines -1
FileRead, file1, 1.txt
FileRead, file2, 2.txt
loop 2
{
   If A_Index = 1
      a := file1, b := file2
   Else
      a := file2, b := file1
   obj := []
   loop, parse, a, `n, `r
      obj[A_LoopField] := 1
   loop, parse, b, `n, `r
      res .= !obj[A_LoopField] ? (res?&quot;`n&quot;:&quot;&quot;) A_LoopField : &quot;&quot;
}
MsgBox % res</code></pre></div>]]></content>
			<author>
				<name><![CDATA[DD]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=25263</uri>
			</author>
			<updated>2018-05-07T05:04:16Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=125173#p125173</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Удаление одинаковых строк из файла №2, содержащихся в файле №1]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=98889#p98889" />
			<content type="html"><![CDATA[<p>Оказалось, что для обработки крупных файлов к #MaxMem можно прибавлять значение в мегабайтах, увеличивающих память.</p>]]></content>
			<author>
				<name><![CDATA[DD]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=25263</uri>
			</author>
			<updated>2015-11-09T17:05:11Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=98889#p98889</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Удаление одинаковых строк из файла №2, содержащихся в файле №1]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=98867#p98867" />
			<content type="html"><![CDATA[<p>Гранд Респект!</p>]]></content>
			<author>
				<name><![CDATA[DD]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=25263</uri>
			</author>
			<updated>2015-11-08T23:42:01Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=98867#p98867</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Удаление одинаковых строк из файла №2, содержащихся в файле №1]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=98866#p98866" />
			<content type="html"><![CDATA[<div class="codebox"><pre><code>SetBatchLines -1
FileRead, file1, 1.txt
FileRead, file2, 2.txt
loop 2
{
   If A_Index = 1
      a := file1, b := file2
   Else
      a := file2, b := file1
   obj := []
   loop, parse, a, `n, `r
      obj[A_LoopField] := 1
   loop, parse, b, `n, `r
      res .= !obj[A_LoopField] ? (res?&quot;`n&quot;:&quot;&quot;) A_LoopField : &quot;&quot;
}
MsgBox % res</code></pre></div>]]></content>
			<author>
				<name><![CDATA[Malcev]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=26930</uri>
			</author>
			<updated>2015-11-08T23:34:20Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=98866#p98866</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Удаление одинаковых строк из файла №2, содержащихся в файле №1]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=98865#p98865" />
			<content type="html"><![CDATA[<p>Извиняюсь, рассеянный я)) Задача действительно немного другая: удалить одинаковые строки из обоих файлов — оставив те, которые не встречаются в другом.</p>]]></content>
			<author>
				<name><![CDATA[DD]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=25263</uri>
			</author>
			<updated>2015-11-08T23:31:33Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=98865#p98865</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Удаление одинаковых строк из файла №2, содержащихся в файле №1]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=98862#p98862" />
			<content type="html"><![CDATA[<p>Скрипт работает согласно задаче:<br /></p><div class="quotebox"><blockquote><p>Нужно считать файл №1 и удалить такие-же (одинаковые) строки из файла №2</p></blockquote></div><p>Вам нужно конкретизировать задачу.</p>]]></content>
			<author>
				<name><![CDATA[Malcev]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=26930</uri>
			</author>
			<updated>2015-11-08T22:58:21Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=98862#p98862</id>
		</entry>
</feed>
