<?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[Copy, search and replace between 2 HTML files]]></title><description><![CDATA[<p dir="auto">Dear experts,</p>
<p dir="auto">I am a newbie with Notepad++. So, I am sorry if my question makes you boring.<br />
I have to HTML files (named a, b). There is a text phrase “ABC” in file a and this appears in many places (1000 times). There are 1000 different text phrases (one per line) in HTML file b and they are in order from 1 to 1000. My question is how to automatically copy text from file b and replace in file a by a macro. For more details as the followings:</p>
<ol>
<li>Copy line 1 in file b.</li>
<li>Search for text “ABC” in file a.</li>
<li>Replace “ABC” by paste.</li>
<li>It loops 1000 times.</li>
</ol>
<p dir="auto">I greatly appreciate your help.</p>
<p dir="auto">Bests,</p>
<p dir="auto">Kosmos</p>
]]></description><link>https://community.notepad-plus-plus.org/topic/19186/copy-search-and-replace-between-2-html-files</link><generator>RSS for Node</generator><lastBuildDate>Mon, 15 Jun 2026 08:17:17 GMT</lastBuildDate><atom:link href="https://community.notepad-plus-plus.org/topic/19186.rss" rel="self" type="application/rss+xml"/><pubDate>Thu, 09 Apr 2020 03:09:08 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Copy, search and replace between 2 HTML files on Wed, 03 Jun 2020 21:32:20 GMT]]></title><description><![CDATA[<p dir="auto">Dear <a class="plugin-mentions-user plugin-mentions-a" href="/user/guy038" aria-label="Profile: guy038">@<bdi>guy038</bdi></a> ,</p>
<p dir="auto">I got the solution by correct quotations as the followings:</p>
<p dir="auto">gawk ‘BEGIN {n=0} NF {print &gt; "File_"n".txt"} !NF {n++}’ File_A.txt</p>
<p dir="auto">Best regards,<br />
Kosmos.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/54607</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/54607</guid><dc:creator><![CDATA[Kosmos Huynh]]></dc:creator><pubDate>Wed, 03 Jun 2020 21:32:20 GMT</pubDate></item><item><title><![CDATA[Reply to Copy, search and replace between 2 HTML files on Wed, 03 Jun 2020 21:19:45 GMT]]></title><description><![CDATA[<p dir="auto">Dear <a class="plugin-mentions-user plugin-mentions-a" href="/user/guy038" aria-label="Profile: guy038">@<bdi>guy038</bdi></a>, dear all</p>
<p dir="auto">Today, I have tried your first solution (File_B.txt which contains KOSMOS) and I got the error as in the following:<br />
<img src="/assets/uploads/files/1591219145808-792ca86d-4ebc-4a8f-a63a-5d400ced3af3-image.png" alt="792ca86d-4ebc-4a8f-a63a-5d400ced3af3-image.png" class=" img-fluid img-markdown" /></p>
<p dir="auto">It is the same with your second solution with File_A.txt with blank line) as well.<br />
<img src="/assets/uploads/files/1591218845647-c09891c8-7465-4129-b716-d5e991427523-image.png" alt="c09891c8-7465-4129-b716-d5e991427523-image.png" class=" img-fluid img-markdown" /></p>
<p dir="auto">Could you please kindly give me a favor?</p>
<p dir="auto">Many thanks in advance!<br />
Bests,<br />
Kosmos</p>
]]></description><link>https://community.notepad-plus-plus.org/post/54604</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/54604</guid><dc:creator><![CDATA[Kosmos Huynh]]></dc:creator><pubDate>Wed, 03 Jun 2020 21:19:45 GMT</pubDate></item><item><title><![CDATA[Reply to Copy, search and replace between 2 HTML files on Mon, 13 Apr 2020 04:25:16 GMT]]></title><description><![CDATA[<p dir="auto">Dear <a class="plugin-mentions-user plugin-mentions-a" href="/user/guy038" aria-label="Profile: guy038">@<bdi>guy038</bdi></a> and all,</p>
<p dir="auto">I am so sorry that I responded too late. It seems that everything can be soIved with you. Many thanks in advacne and I will let you know later on.</p>
<p dir="auto">Stay healthy and best regards,<br />
Kosmos</p>
]]></description><link>https://community.notepad-plus-plus.org/post/52476</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/52476</guid><dc:creator><![CDATA[HienTwi]]></dc:creator><pubDate>Mon, 13 Apr 2020 04:25:16 GMT</pubDate></item><item><title><![CDATA[Reply to Copy, search and replace between 2 HTML files on Sun, 12 Apr 2020 15:58:57 GMT]]></title><description><![CDATA[<p dir="auto">Hello, <a class="plugin-mentions-user plugin-mentions-a" href="/user/hientwi" aria-label="Profile: hientwi">@<bdi>hientwi</bdi></a>, <a class="plugin-mentions-user plugin-mentions-a" href="/user/astrosofista" aria-label="Profile: astrosofista">@<bdi>astrosofista</bdi></a> and <strong>All</strong>,</p>
<p dir="auto">Sorry to be <strong>late</strong> ! So OK : these are <strong>two</strong> tasks absolutely <strong>different</strong> !</p>
<p dir="auto">Well, as you would like to manage <strong>file</strong>’s creation, regexes are <strong>not</strong> a <strong>nice</strong> tool for such a task. Personally, I would use the <strong><code>Gawk</code></strong> application. So, if you do <strong>not</strong> have this program, yet :</p>
<ul>
<li>
<p dir="auto">Create a <strong>new</strong> folder</p>
</li>
<li>
<p dir="auto">Download the <strong><code>gawk-5.0.1-w32-bin-zip</code></strong> archive from    <a href="https://sourceforge.net/projects/ezwinports/files/" rel="nofollow ugc">https://sourceforge.net/projects/ezwinports/files/</a></p>
</li>
<li>
<p dir="auto">Double-click on the <strong><code>gawk-5.0.1-w32-bin-zip</code></strong> archive</p>
</li>
<li>
<p dir="auto">Double-click on the <strong><code>bin</code></strong> folder</p>
</li>
<li>
<p dir="auto">Extract <strong>only</strong> the <strong><code>5</code></strong> files  <strong><code>gawk.exe</code></strong>, <strong><code>libgmp-10.dll</code></strong>, <strong><code>libmpfr-4.dll</code></strong>, <strong><code>libncurses5.dll</code></strong>  and  <strong><code>libreadline6.dll</code></strong> in the <strong>new</strong> folder</p>
</li>
<li>
<p dir="auto">Copy your file <strong><code>A</code></strong> in that folder, which will be <strong>renamed</strong> as <strong><code>File_A.txt</code></strong></p>
</li>
<li>
<p dir="auto">With <strong>N++</strong>, just <strong>add</strong> a line <strong><code>KOSMOS</code></strong>, at the <strong>very beginning</strong> of <strong><code>File_A.txt</code></strong></p>
</li>
<li>
<p dir="auto">Open a <strong>DOS</strong> <strong><code>cmd</code></strong> window</p>
</li>
<li>
<p dir="auto">Type in and run the <strong>following</strong> command :</p>
<ul>
<li><strong><code>gawk "BEGIN {n=0} $0!=\"KOSMOS\" {print &gt; \"File_\"n\".txt\"} $0==\"KOSMOS\" {n++}" File_A.txt</code></strong></li>
</ul>
</li>
<li>
<p dir="auto">Wait a <strong>few</strong> moments … …</p>
</li>
</ul>
<p dir="auto">Et voilà ! You should see, in this <strong>new</strong> folder,  <strong><code>895</code></strong> files from <strong><code>File_1.txt</code></strong> to <strong><code>File_895.txt</code></strong> ;-))</p>
<hr />
<p dir="auto">An <strong>other</strong> possibility would be :</p>
<ul>
<li>
<p dir="auto">With <strong>N++</strong>, just add a line <strong><code>KOSMOS</code></strong>, at the <strong>very beginning</strong> of <strong><code>File_A.txt</code></strong></p>
</li>
<li>
<p dir="auto">Change, in your <strong><code>File_A.txt</code></strong>, each <strong><code>KOSMOS</code></strong> line into a <strong>pure empty</strong> line, with the regex :</p>
<ul>
<li>
<p dir="auto">SEARCH <strong><code>(?-i)^KOSMOS(?=\R)</code></strong></p>
</li>
<li>
<p dir="auto">REPLACE <strong><code>Leave EMPTY</code></strong></p>
</li>
</ul>
</li>
<li>
<p dir="auto">Then, in your <strong>DOS</strong> window, you would run the <strong>following</strong> command :</p>
<ul>
<li><strong><code>gawk "BEGIN {n=0} NF {print &gt; \"File_\"n\".txt\"} !NF {n++}" File_A.txt</code></strong></li>
</ul>
</li>
</ul>
<p dir="auto">That’s all ! <strong>Powerful</strong>, isn’t ?</p>
<p dir="auto"><strong>Remark</strong> : I suppose that your file did <strong>not</strong> contain, <strong>initially</strong>, any <strong>true empty</strong> line !! ( may be searched with the regex <strong><code>^\R</code></strong> )</p>
<hr />
<p dir="auto">For more <strong>information</strong>, you can download the <strong>latest</strong> <strong><code>PDF</code></strong> manual ( gawk <strong><code>v5.0</code></strong> ) from    <a href="https://www.gnu.org/software/gawk/manual/" rel="nofollow ugc">https://www.gnu.org/software/gawk/manual/</a></p>
<p dir="auto">Best Regards</p>
<p dir="auto">guy038</p>
<p dir="auto"><strong>P.S.</strong> :</p>
<p dir="auto">In order to <strong>select</strong> each zone, beginning with a <strong><code>KOSMOS</code></strong> line, till the next <strong><code>KOSMOS</code></strong> line, <strong>excluded</strong>, of your <strong><code>File_A.txt</code></strong>, simply use the <strong>regex</strong> :</p>
<p dir="auto">SEARCH <strong><code>(?-i)(KOSMOS)?(?s).+?(?=^KOSMOS\R|\z)</code></strong></p>
]]></description><link>https://community.notepad-plus-plus.org/post/52425</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/52425</guid><dc:creator><![CDATA[guy038]]></dc:creator><pubDate>Sun, 12 Apr 2020 15:58:57 GMT</pubDate></item><item><title><![CDATA[Reply to Copy, search and replace between 2 HTML files on Sat, 11 Apr 2020 00:22:04 GMT]]></title><description><![CDATA[<p dir="auto">Hi <a class="plugin-mentions-user plugin-mentions-a" href="/user/guy038" aria-label="Profile: guy038">@<bdi>guy038</bdi></a> and all,</p>
<p dir="auto">Sorry that I made you and others confused. I have another purpose which is totally different from my previous question. It means that I have two copies of file A. The one I wanted to split into multiple files based on “KOSMOS”. The other is used for my previous question. They are totally different questions.</p>
<p dir="auto">Best regards,<br />
Kosmos</p>
]]></description><link>https://community.notepad-plus-plus.org/post/52399</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/52399</guid><dc:creator><![CDATA[HienTwi]]></dc:creator><pubDate>Sat, 11 Apr 2020 00:22:04 GMT</pubDate></item><item><title><![CDATA[Reply to Copy, search and replace between 2 HTML files on Fri, 10 Apr 2020 12:22:40 GMT]]></title><description><![CDATA[<p dir="auto">Hello, <a class="plugin-mentions-user plugin-mentions-a" href="/user/hientwi" aria-label="Profile: hientwi">@<bdi>hientwi</bdi></a>, <a class="plugin-mentions-user plugin-mentions-a" href="/user/astrosofista" aria-label="Profile: astrosofista">@<bdi>astrosofista</bdi></a> and <strong>All</strong>,</p>
<p dir="auto">I’m quite <strong>confused</strong>, because I don’t see, exactly, the connexion between your <strong>previous</strong> goal and your <strong>new</strong> one ?</p>
<p dir="auto">Indeed, once your file <strong><code>A</code></strong> has been modified with our <strong>previous</strong> process, it does <strong>not</strong> contain any <strong><code>KOSMOS</code></strong> line which have <strong>all</strong> been replaced with a <strong>specific</strong> line from file <strong><code>B</code></strong>. So, it would be more difficult to <strong>determine</strong> each <strong>section</strong> which would have to be saved in the <strong><code>895</code></strong>  files !</p>
<p dir="auto">On the other hand, If you decide to split the <strong>initial</strong> contents of file <strong><code>A</code></strong> into <strong><code>895</code></strong> files, <strong>first</strong>, then you’ll have to replace the <strong>first</strong> <strong><code>KOSMOS</code></strong> line of each file by the <strong>appropriate</strong> line of file <strong><code>B</code></strong> which seems to be more difficult than with my <strong>previous</strong> method !</p>
<p dir="auto">Please, could you <strong>enlighten</strong> us ?</p>
<p dir="auto">Best Regards,</p>
<p dir="auto">guy038</p>
]]></description><link>https://community.notepad-plus-plus.org/post/52366</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/52366</guid><dc:creator><![CDATA[guy038]]></dc:creator><pubDate>Fri, 10 Apr 2020 12:22:40 GMT</pubDate></item><item><title><![CDATA[Reply to Copy, search and replace between 2 HTML files on Thu, 09 Apr 2020 22:47:58 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/hientwi" aria-label="Profile: HienTwi">@<bdi>HienTwi</bdi></a></p>
<p dir="auto">Good to know. Thank you for getting back to me.</p>
<p dir="auto">Best Regards.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/52362</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/52362</guid><dc:creator><![CDATA[astrosofista]]></dc:creator><pubDate>Thu, 09 Apr 2020 22:47:58 GMT</pubDate></item><item><title><![CDATA[Reply to Copy, search and replace between 2 HTML files on Thu, 09 Apr 2020 22:04:30 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/astrosofista" aria-label="Profile: astrosofista">@<bdi>astrosofista</bdi></a> many thanks for your comments. The problem is solved with <a class="plugin-mentions-user plugin-mentions-a" href="/user/guy038" aria-label="Profile: guy038">@<bdi>guy038</bdi></a> solution.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/52361</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/52361</guid><dc:creator><![CDATA[HienTwi]]></dc:creator><pubDate>Thu, 09 Apr 2020 22:04:30 GMT</pubDate></item><item><title><![CDATA[Reply to Copy, search and replace between 2 HTML files on Thu, 09 Apr 2020 22:03:01 GMT]]></title><description><![CDATA[<p dir="auto">Hi <a class="plugin-mentions-user plugin-mentions-a" href="/user/guy038" aria-label="Profile: guy038">@<bdi>guy038</bdi></a>  and all,</p>
<p dir="auto">Definitely, it works perfectly with <a class="plugin-mentions-user plugin-mentions-a" href="/user/guy038" aria-label="Profile: guy038">@<bdi>guy038</bdi></a> smart solution. Many many many thanks for your solution which helps me a lots to save my time. It would be really nice if you can explain the regexes syntax, when you have free time!</p>
<p dir="auto">In addition, I want to split file A into 895 files based on “KOSMOS”. Could you please give me a further favor? For instances,</p>
<p dir="auto">file 1: From the very beginning of file A to the first KOSMOS, but not include it.<br />
file 2: From the 1st KOSMOS to the 2nd KOSMOS (not include the 2nd)<br />
file 3 ,… file 895 are similar file 2. The last KOSMOS (895th) I will be excluded.</p>
<p dir="auto">Bests,<br />
Kosmos</p>
]]></description><link>https://community.notepad-plus-plus.org/post/52360</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/52360</guid><dc:creator><![CDATA[HienTwi]]></dc:creator><pubDate>Thu, 09 Apr 2020 22:03:01 GMT</pubDate></item><item><title><![CDATA[Reply to Copy, search and replace between 2 HTML files on Fri, 10 Apr 2020 10:44:36 GMT]]></title><description><![CDATA[<p dir="auto">Hi, <a class="plugin-mentions-user plugin-mentions-a" href="/user/hientwi" aria-label="Profile: hientwi">@<bdi>hientwi</bdi></a> and <strong>All</strong>,</p>
<p dir="auto">Ah…, of course, It <strong>cannot</strong> work because, there are a <strong>random</strong> number of lines between each <strong><code>KOSMOS</code></strong> line ! So, here is an <strong>other</strong> method which should work <strong>fine</strong>, although it contains <strong>numerous</strong> steps  ;-))</p>
<p dir="auto">To begin with, from your <strong>pictures</strong>, I noticed that your file <strong><code>A</code></strong> contains <strong><code>223,145</code></strong> lines and I assume that your file <strong><code>B</code></strong> contains <strong><code>895</code></strong> lines <strong>only</strong></p>
<p dir="auto">OK, let’s go !</p>
<hr />
<ul>
<li>Open your <strong>two</strong> files <strong><code>A</code></strong> and <strong><code>B</code></strong> in Notepad++</li>
</ul>
<p dir="auto">Let’s suppose the following file <strong><code>A</code></strong>, containing <strong>only</strong> <strong><code>5</code></strong> lines <strong>KOSMOS</strong>, among the <strong><code>223,145</code></strong> lines of file <strong><code>A</code></strong>, then the <strong>input</strong> text :</p>
<pre><code class="language-mk">Line 1
Line 2
Line 3
KOSMOS
Line 5
KOSMOS
Line 7
KOSMOS
Line 9
.....
.....
.....
.....
Line 223,139
KOSMOS
Line 223,141
Line 223,142
KOSMOS
Line 223,144
Line 223,145
</code></pre>
<ul>
<li>
<p dir="auto">Open the <strong>Column Editor`</strong></p>
<ul>
<li>
<p dir="auto">Select <strong><code>Number to Insert</code></strong></p>
</li>
<li>
<p dir="auto">Type in <strong><code>1</code></strong> in the following <strong>three</strong> zones</p>
</li>
<li>
<p dir="auto"><strong>Tick</strong> the <strong><code>Leading zeros</code></strong> option</p>
</li>
<li>
<p dir="auto">Verify the <strong><code>Dec</code></strong> format</p>
</li>
<li>
<p dir="auto">Click on the <strong><code>OK</code></strong> button</p>
</li>
</ul>
</li>
</ul>
<p dir="auto">You should get :</p>
<pre><code class="language-mk">000001Line 1
000002Line 2
000003Line 3
000004KOSMOS
000005Line 5
000006KOSMOS
000007Line 7
000008KOSMOS
000009Line 9
xxxxxx.....
xxxxxx.....
xxxxxx.....
xxxxxx.....
223139Line 223,139
223140KOSMOS
223141Line 223,141
223142Line 223,142
223143KOSMOS
223144Line 223,144
223145Line 223,145
</code></pre>
<ul>
<li>
<p dir="auto">Now open the <strong>Mark</strong> dialog ( <strong><code>Search &gt; Mark...</code></strong> option )</p>
<ul>
<li>
<p dir="auto">SEARCH <strong><code>(?-i)KOSMOS</code></strong></p>
</li>
<li>
<p dir="auto">Option <strong><code>Bookmark line</code></strong> <strong>ticked</strong></p>
</li>
<li>
<p dir="auto">Option <strong><code>Purge for each search</code></strong> <strong>ticked</strong>, preferably</p>
</li>
<li>
<p dir="auto">Option <strong><code>Wrap around</code></strong> <strong>ticked</strong></p>
</li>
<li>
<p dir="auto">Mode <strong><code>Regular expression</code></strong> selected</p>
</li>
<li>
<p dir="auto">Click on the <strong><code>Mark All</code></strong></p>
</li>
</ul>
</li>
</ul>
<p dir="auto">=&gt; The <strong><code>895</code></strong> lines <strong><code>KOSMOS</code></strong> should be <strong>bookmarked</strong></p>
<ul>
<li>
<p dir="auto">Then, run the option <strong><code>Search &gt; Bookmark &gt; Copy bookmarked Lines</code></strong></p>
</li>
<li>
<p dir="auto">Now, select your File <strong><code>B</code></strong> tab, containing also <strong><code>5</code></strong> lines, which will replace each <strong>KOSMOS</strong> line of file <strong><code>A</code></strong></p>
</li>
</ul>
<pre><code class="language-mk">-- The Line 1 contents ( File B ) --
-- The Line 2 contents ( File B ) --
-- The Line 3 contents ( File B ) --
-- The Line 4 contents ( File B ) --
-- The Line 5 contents ( File B ) --
</code></pre>
<ul>
<li>
<p dir="auto"><strong>After</strong> the <strong><code>895</code></strong> lines of file <strong><code>B</code></strong>, <strong>add</strong> a <strong>separation</strong> line with, at <strong>least</strong>, <strong><code>3</code></strong> consecutive <strong>equal</strong> signs, so the string <strong><code>===</code></strong> with a <strong>line-break</strong></p>
</li>
<li>
<p dir="auto">Then <strong>paste</strong> the contents of the clipboard, with <strong><code>Ctrl + V</code></strong> ( so the <strong><code>895</code></strong> lines KOSMOS of file <strong><code>A</code></strong> )</p>
</li>
</ul>
<p dir="auto">Thus, the contents of file <strong><code>B</code></strong> should contain <strong><code>895</code></strong> lines <strong>before</strong> the <strong><code>===</code></strong>: line and <strong><code>895</code></strong> <strong>after</strong> ( <strong><code>5</code></strong>, in our example )</p>
<pre><code class="language-mk">-- The Line 1 contents ( File B ) --
-- The Line 2 contents ( File B ) --
-- The Line 3 contents ( File B ) --
-- The Line 4 contents ( File B ) --
-- The Line 5 contents ( File B ) --
===
000004KOSMOS
000006KOSMOS
000008KOSMOS
223140KOSMOS
223143KOSMOS
</code></pre>
<ul>
<li>
<p dir="auto">Perform the following regex S/R, in the <strong>Replace</strong> dialog ( <strong><code>Ctrl + H</code></strong> )</p>
<ul>
<li>
<p dir="auto">SEARCH <strong><code>(?-si).+(?=\R(?s:.+?\R){5}(.+))|(?s)===.+</code></strong> ( Of course, use the <strong>quantifier</strong> <strong><code>{895}</code></strong>, instead of <strong><code>{5}</code></strong>, with your <strong>present</strong> file <strong><code>B</code></strong> )</p>
</li>
<li>
<p dir="auto">REPLACE <strong><code>?1\1$0</code></strong></p>
</li>
<li>
<p dir="auto">Option <strong><code>Wrap around</code></strong> <strong>ticked</strong> and <strong><code>Regular expression</code></strong> selected</p>
</li>
<li>
<p dir="auto">Click on the <strong><code>Replace All</code></strong> button</p>
</li>
</ul>
</li>
</ul>
<p dir="auto">After <strong><code>895</code></strong> replacements ( <strong><code>5</code></strong>, in our example ), we get, at once, the following text :</p>
<pre><code class="language-mk">000004KOSMOS-- The Line 1 contents ( File B ) --
000006KOSMOS-- The Line 2 contents ( File B ) --
000008KOSMOS-- The Line 3 contents ( File B ) --
223140KOSMOS-- The Line 4 contents ( File B ) --
223143KOSMOS-- The Line 5 contents ( File B ) --
</code></pre>
<ul>
<li>
<p dir="auto">Then select <strong>all</strong> the contents of file <strong><code>B</code></strong>, with <strong><code>Ctrl + A</code></strong></p>
</li>
<li>
<p dir="auto">Copy it into the <strong>clipboard</strong>, with <strong><code>Ctrl + C</code></strong></p>
</li>
<li>
<p dir="auto">Select the file <strong><code>A</code></strong>  tab</p>
</li>
<li>
<p dir="auto"><strong>Paste</strong> the clipboard contents, after the <strong>last</strong> line of file <strong><code>A</code></strong>, with <strong><code>Ctrl + V</code></strong></p>
</li>
</ul>
<p dir="auto">=&gt; So, the file <strong><code>A</code></strong> contents are as below :</p>
<pre><code class="language-mk">000001Line 1
000002Line 2
000003Line 3
000004KOSMOS
000005Line 5
000006KOSMOS
000007Line 7
000008KOSMOS
000009Line 9
xxxxxx.....
xxxxxx.....
xxxxxx.....
xxxxxx.....
223139Line 223,139
223140KOSMOS
223141Line 223,141
223142Line 223,142
223143KOSMOS
223144Line 223,144
223145Line 223,145
000004KOSMOS-- The Line 1 contents ( File B ) --
000006KOSMOS-- The Line 2 contents ( File B ) --
000008KOSMOS-- The Line 3 contents ( File B ) --
223140KOSMOS-- The Line 4 contents ( File B ) --
223143KOSMOS-- The Line 5 contents ( File B ) --
</code></pre>
<ul>
<li>Now, <strong>sort</strong> the lines of file <strong><code>A</code></strong>, with the option <strong><code>Edit Line operations &gt; Sort Lines Lexicographically Ascending</code></strong></li>
</ul>
<p dir="auto">We get the following <strong>output</strong> :</p>
<pre><code class="language-mk">000001Line 1
000002Line 2
000003Line 3
000004KOSMOS
000004KOSMOS-- The Line 1 contents ( File B ) --
000005Line 5
000006KOSMOS
000006KOSMOS-- The Line 2 contents ( File B ) --
000007Line 7
000008KOSMOS
000008KOSMOS-- The Line 3 contents ( File B ) --
000009Line 9
xxxxxx.....
xxxxxx.....
xxxxxx.....
xxxxxx.....
223139Line 223,139
223140KOSMOS
223140KOSMOS-- The Line 4 contents ( File B ) --
223141Line 223,141
223142Line 223,142
223143KOSMOS
223143KOSMOS-- The Line 5 contents ( File B ) --
223144Line 223,144
223145Line 223,145
</code></pre>
<p dir="auto">Finally, run this <strong>last</strong> regex S/R :</p>
<ul>
<li>
<p dir="auto">SEARCH <strong><code>(?-is)^\d{6}|\h*KOSMOS\h*\R?</code></strong></p>
</li>
<li>
<p dir="auto">REPLACE <strong><code>Leave EMPTY</code></strong></p>
</li>
</ul>
<p dir="auto">Here we are ! We have the <strong>expected</strong> output, below :</p>
<pre><code class="language-mk">Line 1
Line 2
Line 3
-- The Line 1 contents ( File B ) --
Line 5
-- The Line 2 contents ( File B ) --
Line 7
-- The Line 3 contents ( File B ) --
Line 9
.....
.....
.....
.....
Line 223,139
-- The Line 4 contents ( File B ) --
Line 223,141
Line 223,142
-- The Line 5 contents ( File B ) --
Line 223,144
Line 223,145
</code></pre>
<hr />
<p dir="auto">If <strong>OK</strong>, I’ll explain the <strong>regexes</strong> syntax, next time !</p>
<p dir="auto">See you later,</p>
<p dir="auto">Best Regards,</p>
<p dir="auto">guy038</p>
]]></description><link>https://community.notepad-plus-plus.org/post/52344</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/52344</guid><dc:creator><![CDATA[guy038]]></dc:creator><pubDate>Fri, 10 Apr 2020 10:44:36 GMT</pubDate></item><item><title><![CDATA[Reply to Copy, search and replace between 2 HTML files on Thu, 09 Apr 2020 18:26:21 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/hientwi" aria-label="Profile: HienTwi">@<bdi>HienTwi</bdi></a> said in <a href="/post/52335">Copy, search and replace between 2 HTML files</a>:</p>
<blockquote>
<p dir="auto">In my opinion, the problem could be the number of lines of file a-copied content does not exactly match to file b. However, I am not so sure and I also do not have any idea to deal with it.</p>
</blockquote>
<p dir="auto">Hi <a class="plugin-mentions-user plugin-mentions-a" href="/user/hientwi" aria-label="Profile: hientwi">@<bdi>hientwi</bdi></a>, All,</p>
<p dir="auto">I don’t know if that is actually the cause of the failure, but you can easily check how many instances of “<code>KOSMOS</code>” are in file A. To get it, please go to the very beginning of <code>file A</code>, open the <code>Find window</code>, type “<code>KOSMOS</code>” in the <code>Find box</code> and click on <code>Count</code>. Look for the number of matches at the <code>bottom of the Find window</code>.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/52343</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/52343</guid><dc:creator><![CDATA[astrosofista]]></dc:creator><pubDate>Thu, 09 Apr 2020 18:26:21 GMT</pubDate></item><item><title><![CDATA[Reply to Copy, search and replace between 2 HTML files on Thu, 09 Apr 2020 12:02:50 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/guy038" aria-label="Profile: guy038">@<bdi>guy038</bdi></a> said in <a href="/post/52333">Copy, search and replace between 2 HTML files</a>:</p>
<blockquote>
<p dir="auto">?1\1</p>
</blockquote>
<p dir="auto">Hallo <a class="plugin-mentions-user plugin-mentions-a" href="/user/guy038" aria-label="Profile: guy038">@<bdi>guy038</bdi></a> ,</p>
<p dir="auto">Thank you very much for your quick support. Your solution is exactly what I wanted to have. But, I have played with my files but it did not work out and I could not get the same result as yours. So, I would like to make my question is clearer.</p>
<p dir="auto">My file a have 895 “KOSMOS” and they are placed in a single line. And, this is the first one.<br />
<img src="/assets/uploads/files/1586432353761-c362ddf0-acb9-4586-82fd-6f4ba0684c0a-image.png" alt="c362ddf0-acb9-4586-82fd-6f4ba0684c0a-image.png" class=" img-fluid img-markdown" /></p>
<p dir="auto">So, I would like to replace the first “KOSMOS” by the file line in my file b.<br />
<img src="/assets/uploads/files/1586432509024-cc48ce39-76e1-492e-a136-fc0fde39be57-image.png" alt="cc48ce39-76e1-492e-a136-fc0fde39be57-image.png" class=" img-fluid img-markdown" /></p>
<p dir="auto">And then, it will repeat the procedure until the last “KOSMOS” with line 895 in file b.</p>
<p dir="auto">So,…</p>
<ul>
<li>I copy the content of file a started from first “KOSMOS” and end with the last KOSMOS one, then I pasted to a new tab.</li>
<li>I appended this new tab with 895 lines from file b.<br />
<img src="/assets/uploads/files/1586433545604-073821b8-bde1-4cb8-897c-03af3bb9b7b4-image.png" alt="073821b8-bde1-4cb8-897c-03af3bb9b7b4-image.png" class=" img-fluid img-markdown" /></li>
<li>I followed your instructions but I could not the expected results.<br />
<img src="/assets/uploads/files/1586433742845-7ab30ea4-d826-4cbf-af75-e295e3a49dd3-image.png" alt="7ab30ea4-d826-4cbf-af75-e295e3a49dd3-image.png" class=" img-fluid img-markdown" /><br />
In my opinion, the problem could be the number of lines of file a-copied content does not exactly match to file b. However, I am not so sure and I also do not have any idea to deal with it.</li>
</ul>
<p dir="auto">Could you please give me a suggestion?</p>
<p dir="auto">Many thanks in advance!<br />
Kosmos</p>
]]></description><link>https://community.notepad-plus-plus.org/post/52335</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/52335</guid><dc:creator><![CDATA[HienTwi]]></dc:creator><pubDate>Thu, 09 Apr 2020 12:02:50 GMT</pubDate></item><item><title><![CDATA[Reply to Copy, search and replace between 2 HTML files on Thu, 09 Apr 2020 09:37:41 GMT]]></title><description><![CDATA[<p dir="auto">Hello, <a class="plugin-mentions-user plugin-mentions-a" href="/user/hientwi" aria-label="Profile: hientwi">@<bdi>hientwi</bdi></a> and <strong>All</strong>,</p>
<p dir="auto">Just a <strong>first</strong> try to verify if I <strong>correctly</strong> understood your needs !</p>
<p dir="auto">Let’s suppose we have <strong>two</strong> files <strong><code>A</code></strong> and <strong><code>B</code></strong>, containing, <strong>each</strong>, <strong><code>5</code></strong> lines</p>
<ul>
<li>
<p dir="auto">First, we paste the contents of file <strong><code>A</code></strong> in a <strong>new</strong> N++ tab</p>
</li>
<li>
<p dir="auto">Secondly, we write a <strong>separation</strong> line, with, at <strong>least</strong>, three consecutive <strong>equal</strong> signs, so the minimum string  <strong><code>===</code></strong>, in the <strong>new</strong> tab</p>
</li>
<li>
<p dir="auto">Finally, we append the contents of file <strong><code>B</code></strong>, in the <strong>new</strong> N++ tab</p>
</li>
</ul>
<p dir="auto">Then, for instance, we get the following <strong>input</strong> text :</p>
<pre><code class="language-mk">First line of file A with text ABC
Text ABC in the second line of file A
File A : Third line with ABC text
Fourth text ABC of line 4 in file A
ABC = contents of last line 5 of file A
===
-- The Line 1 contents ( File B ) --
-- The Line 2 contents ( File B ) --
-- The Line 3 contents ( File B ) --
-- The Line 4 contents ( File B ) --
-- The Line 5 contents ( File B ) --
</code></pre>
<p dir="auto">By running the regex S/R, below :</p>
<ul>
<li>
<p dir="auto">SEARCH <strong><code>(?-si)ABC(?=.*\R(?s:.+?\R){5}(.+))|(?s)===.+</code></strong></p>
</li>
<li>
<p dir="auto">REPLACE <strong><code>?1\1</code></strong></p>
</li>
<li>
<p dir="auto">The <strong><code>Wrap option</code></strong> option <strong>ticked</strong> and the <strong><code>Regular expression</code></strong> search mode <strong>chosen</strong></p>
</li>
<li>
<p dir="auto">A click on the <strong><code>Replace All</code></strong> button</p>
</li>
</ul>
<p dir="auto">We get the <strong>output</strong> text, below :</p>
<pre><code class="language-mk">First line of file A with text -- The Line 1 contents ( File B ) --
Text -- The Line 2 contents ( File B ) -- in the second line of file A
File A : Third line with -- The Line 3 contents ( File B ) -- text
Fourth text -- The Line 4 contents ( File B ) -- of line 4 in file A
-- The Line 5 contents ( File B ) -- = contents of last line 5 of file A
</code></pre>
<p dir="auto">As you can see, the string <strong><code>ABC</code></strong>, in the <strong>first</strong> five lines of file <strong><code>A</code></strong>, in the <strong>input</strong> text, have been replaced, in the <strong>output</strong> text, by, <strong>successively</strong>, the <strong>last</strong> five lines of file <strong><code>B</code></strong></p>
<hr />
<p dir="auto">Are you expecting this <strong>kind</strong> of search/replacement ?</p>
<p dir="auto">See you later,</p>
<p dir="auto">guy038</p>
]]></description><link>https://community.notepad-plus-plus.org/post/52333</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/52333</guid><dc:creator><![CDATA[guy038]]></dc:creator><pubDate>Thu, 09 Apr 2020 09:37:41 GMT</pubDate></item></channel></rss>