<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title><![CDATA[Серый форум &mdash; VBS: Сравнить две строки в csv]]></title>
		<link>https://forum.script-coding.com/viewtopic.php?id=15744</link>
		<atom:link href="https://forum.script-coding.com/extern.php?action=feed&amp;tid=15744&amp;type=rss" rel="self" type="application/rss+xml" />
		<description><![CDATA[Недавние сообщения в теме «VBS: Сравнить две строки в csv».]]></description>
		<lastBuildDate>Sat, 24 Oct 2020 18:07:26 +0000</lastBuildDate>
		<generator>PunBB</generator>
		<item>
			<title><![CDATA[Re: VBS: Сравнить две строки в csv]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=142761#p142761</link>
			<description><![CDATA[<div class="quotebox"><cite>alexii пишет:</cite><blockquote><p>Но, Холмс, как?!!<br /></p><div class="codebox"><pre><code>20201013;08:05:00;2;4;53,8;123</code></pre></div><div class="codebox"><pre><code>20201013;08:01:00;2;4;53,6;123</code></pre></div><p>Как из 08:05:00 получается 08:01:00?! Как из 53,8 получается 53,6?! И так далее…</p><p>И почему в последней строке нет запятой?</p></blockquote></div><p>Это просто пример, главное последние числа, 123, 127 и.т.д<br />Если последние числа одинаковы, нужно полностью убрать всю строку.<br />На предыдущие числа, значения не надо обращать внимание.<br />Запятую забыл поставить.</p>]]></description>
			<author><![CDATA[null@example.com (mers)]]></author>
			<pubDate>Sat, 24 Oct 2020 18:07:26 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=142761#p142761</guid>
		</item>
		<item>
			<title><![CDATA[Re: VBS: Сравнить две строки в csv]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=142759#p142759</link>
			<description><![CDATA[<p>Но, Холмс, как?!!<br /></p><div class="codebox"><pre><code>20201013;08:05:00;2;4;53,8;123</code></pre></div><div class="codebox"><pre><code>20201013;08:01:00;2;4;53,6;123</code></pre></div><p>Как из 08:05:00 получается 08:01:00?! Как из 53,8 получается 53,6?! И так далее…</p><p>И почему в последней строке нет запятой?</p>]]></description>
			<author><![CDATA[null@example.com (alexii)]]></author>
			<pubDate>Sat, 24 Oct 2020 18:00:44 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=142759#p142759</guid>
		</item>
		<item>
			<title><![CDATA[VBS: Сравнить две строки в csv]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=142758#p142758</link>
			<description><![CDATA[<p>Приветствую всех,</p><p>поиском ничего не нашёл, решил так спросить.</p><p>Делаю первые шаги в VBS.<br />Нужно в csv файле снизу начать сравнивать строки.</p><p>Примет csv.<br /></p><div class="codebox"><pre><code>data;utc;set;mod;tz;sz,
20201013;08:00:00;2;4;48,5;125,
20201013;08:01:00;2;4;53,6;125,
20201013;08:02:00;2;4;37,3;128,
20201013;08:03:00;2;4;53,1;127,
20201013;08:04:00;2;4;53,4;127,
20201013;08:05:00;2;4;53,8;123</code></pre></div><p>Если конечное число совпадает, то удалить полностью строчку.<br />Фокус на конечные числа в строке.<br />Например должно потом выглядеть так:<br /></p><div class="codebox"><pre><code>20201013;08:00:00;2;4;48,5;125,
20201013;08:02:00;2;4;37,3;128,
20201013;08:01:00;2;4;53,6;127,
20201013;08:01:00;2;4;53,6;123</code></pre></div><p>Результат можно переписать в другой файл.<br />Пробовал сам, но что то не выходит.<br />Может кто помочь?<br />Буду очень признателен.</p><div class="codebox"><pre><code>Dim FSO, infile, outfile, fqdn , mArray, mArray1, d1, utc1, st1, md1, tz1, sz1, d2, utc2, st2, md2, tz2, sz2
Const ForReading = 1
Const ForWriting = 2
Set fso = CreateObject(&quot;Scripting.FileSystemObject&quot;)
Set infile  = fso.OpenTextFile(&quot;I:\source\repos\vbs\input.csv&quot;, ForReading)
Set outfile = fso.OpenTextFile(&quot;I:\source\repos\vbs\output.txt&quot;, ForWriting, true)

Do Until infile.AtEndOfStream

  mArray = Split(infile.ReadLine, &quot;;&quot;) 
  d1= mArray(0)
  utc1 = mArray(1)
  st1 = mArray(2)
  md1 = mArray(3)
  tz1 = mArray(4)
  st1 = mArray(5)
  
  fqdn = Split(infile.ReadLine, &quot;,&quot;)(0)
  mArray1 = Split(fqdn.ReadLine, &quot;;&quot;)
   d1= mArray1(0)
  utc1 = mArray1(1)
  st1 = mArray1(2)
  md1 = mArray1(3)
  tz1 = mArray1(4)
  st1 = mArray1(5)
  
   &#039;WScript.Echo  sz1 &amp; sz2
   &#039;If LCase(sz1) = LCase(sz2) Then 
  &#039; else
  &#039; outfile.WriteLine d1 &amp; &quot;;&quot; &amp; utc1 &amp; &quot;;&quot; &amp; st1 &amp; &quot;;&quot; &amp; md1 &amp; &quot;;&quot; &amp; tz1 &amp; &quot;;&quot; &amp; sz1
 &#039; end if  
  If sz1 = sz2 Then 
  else
  outfile.WriteLine d1 &amp; &quot;;&quot; &amp; utc1 &amp; &quot;;&quot; &amp; st1 &amp; &quot;;&quot; &amp; md1 &amp; &quot;;&quot; &amp; tz1 &amp; &quot;;&quot; &amp; sz1 
  end if
Loop

infile.Close
outfile.Close True</code></pre></div>]]></description>
			<author><![CDATA[null@example.com (mers)]]></author>
			<pubDate>Sat, 24 Oct 2020 17:38:51 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=142758#p142758</guid>
		</item>
	</channel>
</rss>
