<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[I want to merge the content of two files but I don&#x27;t know if it&#x27;s possible, Please help]]></title><description><![CDATA[<p dir="auto">I have two files that differ in content and I want to make a third one that combines both but I don’t know if it’s possible. The lines look something like this:</p>
<p dir="auto"><strong>File A:</strong></p>
<pre><code>sametext
&lt;text&gt;&lt;![line a[line b, line c, line d, A1, A2, A3&rsqb;&rsqb;&gt;&lt;/text&gt;
sametext
</code></pre>
<p dir="auto"><strong>File B:</strong></p>
<pre><code>sametext
&lt;text&gt;&lt;![line a[line b, line c, line d, B1, B2, B3&rsqb;&rsqb;&gt;&lt;/text&gt;
sametext
</code></pre>
<p dir="auto">And I want to make a third file that looks like this:</p>
<pre><code>sametext
&lt;text&gt;&lt;![line a[line b, line c, line d, A1, A2, A3, B1, B2, B3&rsqb;&rsqb;&gt;&lt;/text&gt;
sametext
</code></pre>
<p dir="auto">Forgive me if this is an easy task but sadly I don’t have the knowledge to do it so I figured I could ask here if it’s possible. Thanks in advance.</p>
]]></description><link>https://community.notepad-plus-plus.org/topic/18256/i-want-to-merge-the-content-of-two-files-but-i-don-t-know-if-it-s-possible-please-help</link><generator>RSS for Node</generator><lastBuildDate>Mon, 20 Jul 2026 13:02:39 GMT</lastBuildDate><atom:link href="https://community.notepad-plus-plus.org/topic/18256.rss" rel="self" type="application/rss+xml"/><pubDate>Sat, 14 Sep 2019 07:13:57 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to I want to merge the content of two files but I don&#x27;t know if it&#x27;s possible, Please help on Sat, 19 Oct 2019 18:22:54 GMT]]></title><description><![CDATA[<p dir="auto">Hello, <a class="plugin-mentions-user plugin-mentions-a" href="/user/darklinkpower" aria-label="Profile: darklinkpower">@<bdi>darklinkpower</bdi></a>,</p>
<p dir="auto">I was <strong>away</strong> from the <strong>N++ community</strong>, since more than a <strong>month</strong> ( see my post below )</p>
<p dir="auto"><a href="https://community.notepad-plus-plus.org/post/47895">https://community.notepad-plus-plus.org/post/47895</a></p>
<p dir="auto">So, <a class="plugin-mentions-user plugin-mentions-a" href="/user/darklinkpower" aria-label="Profile: darklinkpower">@<bdi>darklinkpower</bdi></a>, my reply is quite <strong>out of date</strong>. But if you <strong>still</strong> look for a regex solution I can take up the <strong>challenge</strong> of performing this S/R with <strong>regexes</strong> !</p>
<p dir="auto">However you must give me a <strong>real</strong> example of your <strong><code>2</code></strong> ( <strong>short</strong> ) files <strong><code>A</code></strong> and <strong><code>B</code></strong>, as well as the <strong>expected</strong> real <strong>output</strong> file, from these <strong><code>2</code></strong> <strong>input</strong> files</p>
<p dir="auto">Simply, as your files are <strong><code>XML</code></strong> ones, in your <strong>future</strong> post, write your <strong>code</strong> in blocks, like below :</p>
<p dir="auto">~~~xml<br />
…<br />
…<br />
~~~</p>
<hr />
<p dir="auto">Just to give you an <strong>idea</strong>, of the regexes’s <strong>powerful</strong>, let’s suppose the <strong>input</strong> text, below :</p>
<pre><code class="language-diff">&lt;text&gt;&lt;![line a[line b, line c, line d, A1, A2, A3&rsqb;&rsqb;&gt;&lt;/text&gt;
&lt;text&gt;&lt;![line a[line b, line c, line d, B1, B2, B3&rsqb;&rsqb;&gt;&lt;/text&gt;

&lt;text&gt;&lt;![line a[line b, line c, line d, line e, line f, line g, line h, C1, C2, C3, C4&rsqb;&rsqb;&gt;&lt;/text&gt;
&lt;text&gt;&lt;![line a[line b, line c, line d, line e, line f, line g, line h, D1, D2, D3, D4&rsqb;&rsqb;&gt;&lt;/text&gt;

&lt;text&gt;&lt;![line a[Small test, E1, E2, E3, E4, E5, E6, E7, E8, E9&rsqb;&rsqb;&gt;&lt;/text&gt;
&lt;text&gt;&lt;![line a[Small test, F1, F2, F3, F4, F5, F6, F7, F8, F9&rsqb;&rsqb;&gt;&lt;/text&gt;

&lt;text&gt;&lt;![line a[word 1, G1, G2&rsqb;&rsqb;&gt;&lt;/text&gt;
&lt;text&gt;&lt;![line a[word 1, H1, H2&rsqb;&rsqb;&gt;&lt;/text&gt;

&lt;text&gt;&lt;![line a[I1&rsqb;&rsqb;&gt;&lt;/text&gt;
&lt;text&gt;&lt;![line a[J1&rsqb;&rsqb;&gt;&lt;/text&gt;
</code></pre>
<p dir="auto">Then, the following <strong>regex</strong> S/R :</p>
<p dir="auto">SEARCH <strong><code>(?-s)^(.+)(.+)\]\]&gt;&lt;/text&gt;(\R)\1(.+)\R</code></strong></p>
<p dir="auto">REPLACE <strong><code>\1\2, \4\3</code></strong></p>
<p dir="auto">will change, when you click on the <strong><code>Replace All</code></strong> button, in <strong>one</strong> go, the text as below :</p>
<pre><code class="language-diff">&lt;text&gt;&lt;![line a[line b, line c, line d, A1, A2, A3, B1, B2, B3&rsqb;&rsqb;&gt;&lt;/text&gt;

&lt;text&gt;&lt;![line a[line b, line c, line d, line e, line f, line g, line h, C1, C2, C3, C4, D1, D2, D3, D4&rsqb;&rsqb;&gt;&lt;/text&gt;

&lt;text&gt;&lt;![line a[Small test, E1, E2, E3, E4, E5, E6, E7, E8, E9, F1, F2, F3, F4, F5, F6, F7, F8, F9&rsqb;&rsqb;&gt;&lt;/text&gt;

&lt;text&gt;&lt;![line a[word 1, G1, G2, H1, H2&rsqb;&rsqb;&gt;&lt;/text&gt;

&lt;text&gt;&lt;![line a[I1, J1&rsqb;&rsqb;&gt;&lt;/text&gt;
</code></pre>
<p dir="auto">As you can see, this <strong>regex</strong> S/R is able to <strong>differentiate</strong> the first <strong>common</strong> part of <strong>two consecutive</strong> lines from the second <strong>variable</strong> part which must be <strong>merged</strong> in <strong>one</strong> line only ;-))</p>
<p dir="auto">So, see you later !</p>
<p dir="auto">Best Regards,</p>
<p dir="auto">guy038</p>
]]></description><link>https://community.notepad-plus-plus.org/post/47920</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/47920</guid><dc:creator><![CDATA[guy038]]></dc:creator><pubDate>Sat, 19 Oct 2019 18:22:54 GMT</pubDate></item><item><title><![CDATA[Reply to I want to merge the content of two files but I don&#x27;t know if it&#x27;s possible, Please help on Sun, 15 Sep 2019 00:07:12 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/darklinkpower" aria-label="Profile: darklinkpower">@<bdi>darklinkpower</bdi></a> said:</p>
<blockquote>
<p dir="auto">I don’t think it’s the same issue.</p>
</blockquote>
<p dir="auto">I didn’t say it was the same.  I said it sounds similar.   Good job on coming up with a regex that gets you partway there.</p>
<p dir="auto">The problem you see now is that it looks like more of a problem than a simple regex will solve.  (That said, <a class="plugin-mentions-user plugin-mentions-a" href="/user/guy038" aria-label="Profile: guy038">@<bdi>guy038</bdi></a> can work magic with his regex and multi-step regex.)</p>
<p dir="auto">But at first blush, the problem you describe looks to me to be something best solved using programming, rather than being able to solve it with a simple regular expression – which is why I pointed out the PythonScript solution for the other merge-based issue.  One possible way of doing this is using Notepad++'s <a href="https://notepad-plus-plus.org/community/topic/17256/guide-how-to-install-the-pythonscript-plugin-on-notepad-7-6-3-7-6-4-and-above" rel="nofollow ugc">PythonScript plugin</a>, which embeds a Python interpreter inside a Notepad++ plugin environment, allowing you to write a script where Python can directly read and write the open Notepad++ files.  (You can do something similar with Lua using LuaScript Plugin, or JavaScript using “jN Notepad++ Plugin”.)</p>
<p dir="auto">I had meant for the <a href="https://notepad-plus-plus.org/community/topic/18139/how-to-merge/16" rel="nofollow ugc">script linked in the other topic</a> to give you a starting point, because I had thought I’d used just normal line-by-line reading in one and writing in the other.  But since it wants to merge every line in the second onto N copies of every line in the first, I used some tricks, which eliminated the logic which would have helped you; sorry.</p>
<p dir="auto">If you can code in Python (or Lua, or JavaScript), you could probably come up with an algorithm.  The online help for PythonScript is very detailed.</p>
<p dir="auto">Off the top of my head, the top-level description would be “for each of the matches in the second file (and PythonScript has access to a similar regular expression library, so finding those matches won’t be too difficult), grab the right portion of the matching text, and insert it into the correct line of the first file.”  Implementing that in more detail is what programmers get paid for.  For some problems, one of us in the Community occasionally writes the script for free (usually if we’re interested in the problem or see that we can apply it generally to a task that we have to do as well, or if it looks like we could get it in a brief amount of time), but that doesn’t always happen (this isn’t a we-guarantee-we’ll-write-your-code-for-free forum, after all).  And this one looks to me to be a longer problem than I’m likely to have time for in the forseeable future.  Maybe it’ll catch someone else’s eye, though.</p>
<p dir="auto">if you were to come up with a rough attempt of a PythonScript solution, that got close but not exactly what you wanted, and posted it here, there might be more people who would have the time to help point you in the right direction, or show you what Notepad+±specific features of PythonScript that could help.</p>
<p dir="auto">Sorry that I don’t offer more of a solution, but while Notepad++ <em>is</em> powerful, there are some things that are better handled with actual programming, and you may have hit one (unless <a class="plugin-mentions-user plugin-mentions-a" href="/user/guy038" aria-label="Profile: guy038">@<bdi>guy038</bdi></a> proves me wrong).</p>
]]></description><link>https://community.notepad-plus-plus.org/post/47138</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/47138</guid><dc:creator><![CDATA[PeterJones]]></dc:creator><pubDate>Sun, 15 Sep 2019 00:07:12 GMT</pubDate></item><item><title><![CDATA[Reply to I want to merge the content of two files but I don&#x27;t know if it&#x27;s possible, Please help on Sat, 14 Sep 2019 17:22:02 GMT]]></title><description><![CDATA[<p dir="auto">thanks for the help guys<br />
@gurikbal-singh nice idea, I didn’t know you could select multiple lines that way. Please correct me if I’m wrong but this could only work if the line lenghts are in the same place right? because if the text that I want to copy don’t align then I will copy text that I don’t want to</p>
<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/peterjones" aria-label="Profile: PeterJones">@<bdi>PeterJones</bdi></a> I don’t think it’s the same issue. There he has 2 list that he wants to merge, without any extra data that he wants to get rid of. What I want to do is just copy some data of the second file, not all.<br />
After googling around I found what you can use expressions to match text and I came up with this that matches the text I want to copy to the other file, but I don’t know how to copy it to the other file. The files are xml files</p>
<p dir="auto">Here’s what I could come with:<br />
<a href="https://regex101.com/r/xR5PG4/2" rel="nofollow ugc">https://regex101.com/r/xR5PG4/2</a></p>
]]></description><link>https://community.notepad-plus-plus.org/post/47130</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/47130</guid><dc:creator><![CDATA[darklinkpower]]></dc:creator><pubDate>Sat, 14 Sep 2019 17:22:02 GMT</pubDate></item><item><title><![CDATA[Reply to I want to merge the content of two files but I don&#x27;t know if it&#x27;s possible, Please help on Sat, 14 Sep 2019 15:25:19 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/darklinkpower" aria-label="Profile: darklinkpower">@<bdi>darklinkpower</bdi></a>,</p>
<p dir="auto">This sounds very similar to the recent <a href="https://notepad-plus-plus.org/community/topic/18139/how-to-merge/" rel="nofollow ugc">“How to merge” topic</a>.  You may be able to use or modify-for-use the <a href="https://notepad-plus-plus.org/community/topic/18139/how-to-merge/15" rel="nofollow ugc">regex solution</a> solution that <a class="plugin-mentions-user plugin-mentions-a" href="/user/guy038" aria-label="Profile: guy038">@<bdi>guy038</bdi></a> posted or the <a href="https://notepad-plus-plus.org/community/topic/18139/how-to-merge/16" rel="nofollow ugc">PythonScript solution</a> that I posted.  They may have to be tweaked slightly for your exact circumstances, but they are a good starting point.</p>
<p dir="auto">If you get stuck while trying to modify them to meet your needs, let us know what you’ve tried, and what parts are giving you difficulty, and we may be able to help you get unstuck.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/47125</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/47125</guid><dc:creator><![CDATA[PeterJones]]></dc:creator><pubDate>Sat, 14 Sep 2019 15:25:19 GMT</pubDate></item><item><title><![CDATA[Reply to I want to merge the content of two files but I don&#x27;t know if it&#x27;s possible, Please help on Sat, 14 Sep 2019 08:12:22 GMT]]></title><description><![CDATA[<p dir="auto">replace <code>&rsqb;&rsqb;&gt;&lt;/text&gt;</code> with<code> ,</code><br />
after do as given suggest<br />
<a href="https://www.youtube.com/embed/1g8sTZ85Bgg" rel="nofollow ugc">https://www.youtube.com/embed/1g8sTZ85Bgg</a></p>
<p dir="auto">after replace <code>$</code> with <code>&rsqb;&rsqb;&gt;&lt;/text&gt;</code></p>
]]></description><link>https://community.notepad-plus-plus.org/post/47120</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/47120</guid><dc:creator><![CDATA[rinku singh]]></dc:creator><pubDate>Sat, 14 Sep 2019 08:12:22 GMT</pubDate></item><item><title><![CDATA[Reply to I want to merge the content of two files but I don&#x27;t know if it&#x27;s possible, Please help on Sat, 14 Sep 2019 07:39:35 GMT]]></title><description><![CDATA[<p dir="auto">Said text files contain hundreds of lines like this so doing it manually would be very difficult, that’s why I’m looking if there can be a way to do it with n++. I also forgot to add that the lines differ slightly, changing the content of the different line<br />
for example:</p>
<pre><code>&lt;text&gt;&lt;![line a[word, ads, wdwd , wsws, dfdf, dff&rsqb;&rsqb;&gt;&lt;/text&gt;
</code></pre>
<p dir="auto">For the next line, while it follows the same structure, changes in the content after “<strong>line a[</strong>” but end in the same "<strong>&rsqb;&rsqb;&gt;&lt;/text&gt;</strong> ". So basically what I want is a way to fuse the differences together of the lines that differ but I don’t know if it’s possible since there’s not a clear pattern other than the estructure of the lines</p>
]]></description><link>https://community.notepad-plus-plus.org/post/47119</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/47119</guid><dc:creator><![CDATA[darklinkpower]]></dc:creator><pubDate>Sat, 14 Sep 2019 07:39:35 GMT</pubDate></item></channel></rss>