<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic RE: Merge two .dat files in Product Forum</title>
    <link>https://community.blueprism.com/t5/Product-Forum/Merge-two-dat-files/m-p/47649#M3341</link>
    <description>Chr(10) is a LF (newline) symbol in a file, this should work:&lt;BR /&gt;Left([file1],InStr([file1], Chr(10)))&lt;BR /&gt;&lt;BR /&gt;Store it in [header], then check condition (same header in file2?)&lt;BR /&gt;InStr([file2],[header])&amp;gt;0&lt;BR /&gt;&lt;BR /&gt;Yes - remove it from file2 and add rest to file1: [file1] &amp;amp; Replace([file2],[header],"")&lt;BR /&gt;&lt;BR /&gt;Write result to a new file&lt;BR /&gt;&lt;BR /&gt;p.s. That is assuming headers are exactly the same ofc, but I assume its true in your case. Otherwise you'd need to compare them somehow, rest of the logic should not change much.&lt;BR /&gt;------------------------------&lt;BR /&gt;Andrey Kudinov&lt;BR /&gt;Project Manager&lt;BR /&gt;MobileTelesystems PJSC&lt;BR /&gt;Europe/Moscow&lt;BR /&gt;------------------------------&lt;BR /&gt;</description>
    <pubDate>Wed, 11 Aug 2021 12:55:00 GMT</pubDate>
    <dc:creator>AndreyKudinov</dc:creator>
    <dc:date>2021-08-11T12:55:00Z</dc:date>
    <item>
      <title>Merge two .dat files</title>
      <link>https://community.blueprism.com/t5/Product-Forum/Merge-two-dat-files/m-p/47646#M3338</link>
      <description>&lt;SPAN&gt;Hi Community,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I am trying to&amp;nbsp; merge two .dat files after comparing that the&amp;nbsp; first row has the same columns. Syntax for the .dat file is as below(when I open with notepad)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Project ID&amp;nbsp; Employee ID&amp;nbsp; &amp;nbsp; &amp;nbsp; Project Type&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;XXXX&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;xxxxxxxxxxx&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;xx&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;1 ) First I need to check if the column matches in both files&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;2) After that I need to append the content of second file to first file after removing the header&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I thought of renaming .dat with .csv file,Append the records,save and rename back to .dat. but there were two problems :-&amp;nbsp;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;1 ) Headers are in japanese. When i change extension to .csv , japanese characters are getting replaced with some other weird character.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;2) When I append data to csv and rename back to .dat, " is added before the line and after the line as below&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;"Project ID&amp;nbsp; Employee ID&amp;nbsp; &amp;nbsp; &amp;nbsp; Project Type"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;"XXXX&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;xxxxxxxxxxx&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;xx"&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Could someone please suggest how to proceed ?&amp;nbsp;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;------------------------------&lt;BR /&gt;Kirtish Trivedi&lt;BR /&gt;------------------------------&lt;BR /&gt;</description>
      <pubDate>Wed, 11 Aug 2021 03:29:00 GMT</pubDate>
      <guid>https://community.blueprism.com/t5/Product-Forum/Merge-two-dat-files/m-p/47646#M3338</guid>
      <dc:creator>kirtish.trivedi</dc:creator>
      <dc:date>2021-08-11T03:29:00Z</dc:date>
    </item>
    <item>
      <title>RE: Merge two .dat files</title>
      <link>https://community.blueprism.com/t5/Product-Forum/Merge-two-dat-files/m-p/47647#M3339</link>
      <description>Why not just check headers, remove header from 2nd file and append the rest to the first file?&lt;BR /&gt;&lt;BR /&gt;If you don't want to use code stages that would be like:&lt;BR /&gt;1) Load as text files in file1, file2 data items&lt;BR /&gt;2) Get header from file1 (up to first newline)&lt;BR /&gt;3) Check that it exists in file2&lt;BR /&gt;4) Replace header+newline with empty string "" in file2&lt;BR /&gt;5) append file2 to file1&lt;BR /&gt;6) write result&lt;BR /&gt;&lt;BR /&gt;If files are huge, you can do it with code stage without loading everything in memory. &lt;BR /&gt;Also in nix I'd just use tail -n +2 file2.dat &amp;gt;&amp;gt; file1.dat, there should be similar way to do it in powershell too.&lt;BR /&gt;&lt;BR /&gt;------------------------------&lt;BR /&gt;Andrey Kudinov&lt;BR /&gt;Project Manager&lt;BR /&gt;MobileTelesystems PJSC&lt;BR /&gt;Europe/Moscow&lt;BR /&gt;------------------------------&lt;BR /&gt;</description>
      <pubDate>Wed, 11 Aug 2021 10:30:00 GMT</pubDate>
      <guid>https://community.blueprism.com/t5/Product-Forum/Merge-two-dat-files/m-p/47647#M3339</guid>
      <dc:creator>AndreyKudinov</dc:creator>
      <dc:date>2021-08-11T10:30:00Z</dc:date>
    </item>
    <item>
      <title>RE: Merge two .dat files</title>
      <link>https://community.blueprism.com/t5/Product-Forum/Merge-two-dat-files/m-p/47648#M3340</link>
      <description>Hi &lt;a href="https://community.blueprism.com/t5/user/viewprofilepage/user-id/769"&gt;@AndreyKudinov&lt;/a&gt;,&lt;BR /&gt;&lt;BR /&gt;Thank you for your suggestion. &lt;BR /&gt;As per suggestion &lt;SPAN&gt;2) Get header from file1 (up to first newline)&lt;BR /&gt;&lt;/SPAN&gt;&lt;BR /&gt;Could you please assist how to get just the first line from text ? Text file contains almost 20k records hence is there any way I can just access first line for header comparison and NOT the entire content ?​&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;Update : I was able to do it with help of your suggestion. I found position of first newline using InSTR function and then extracted header using MID function.&lt;/STRONG&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;This resolved my overall issue.&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;Thank you for suggestion.&lt;/STRONG&gt;&lt;BR /&gt;&lt;BR /&gt;------------------------------&lt;BR /&gt;Kirtish Trivedi&lt;BR /&gt;------------------------------&lt;BR /&gt;</description>
      <pubDate>Wed, 11 Aug 2021 11:24:00 GMT</pubDate>
      <guid>https://community.blueprism.com/t5/Product-Forum/Merge-two-dat-files/m-p/47648#M3340</guid>
      <dc:creator>kirtish.trivedi</dc:creator>
      <dc:date>2021-08-11T11:24:00Z</dc:date>
    </item>
    <item>
      <title>RE: Merge two .dat files</title>
      <link>https://community.blueprism.com/t5/Product-Forum/Merge-two-dat-files/m-p/47649#M3341</link>
      <description>Chr(10) is a LF (newline) symbol in a file, this should work:&lt;BR /&gt;Left([file1],InStr([file1], Chr(10)))&lt;BR /&gt;&lt;BR /&gt;Store it in [header], then check condition (same header in file2?)&lt;BR /&gt;InStr([file2],[header])&amp;gt;0&lt;BR /&gt;&lt;BR /&gt;Yes - remove it from file2 and add rest to file1: [file1] &amp;amp; Replace([file2],[header],"")&lt;BR /&gt;&lt;BR /&gt;Write result to a new file&lt;BR /&gt;&lt;BR /&gt;p.s. That is assuming headers are exactly the same ofc, but I assume its true in your case. Otherwise you'd need to compare them somehow, rest of the logic should not change much.&lt;BR /&gt;------------------------------&lt;BR /&gt;Andrey Kudinov&lt;BR /&gt;Project Manager&lt;BR /&gt;MobileTelesystems PJSC&lt;BR /&gt;Europe/Moscow&lt;BR /&gt;------------------------------&lt;BR /&gt;</description>
      <pubDate>Wed, 11 Aug 2021 12:55:00 GMT</pubDate>
      <guid>https://community.blueprism.com/t5/Product-Forum/Merge-two-dat-files/m-p/47649#M3341</guid>
      <dc:creator>AndreyKudinov</dc:creator>
      <dc:date>2021-08-11T12:55:00Z</dc:date>
    </item>
  </channel>
</rss>

