<?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[Combine 2 texts line by line]]></title><description><![CDATA[<p dir="auto">Hi all!</p>
<p dir="auto">How can I combine 2 texts (or 2 files) in notepad++ line by line?</p>
<p dir="auto">Thus:<br />
1 line from text1 (or file1)<br />
1 line from text2 (or file2)<br />
2 line from text1 (or file1)<br />
2 line from text2 (or file2)<br />
…<br />
ect?</p>
<p dir="auto">Thanks!</p>
]]></description><link>https://community.notepad-plus-plus.org/topic/14965/combine-2-texts-line-by-line</link><generator>RSS for Node</generator><lastBuildDate>Mon, 13 Apr 2026 07:42:48 GMT</lastBuildDate><atom:link href="https://community.notepad-plus-plus.org/topic/14965.rss" rel="self" type="application/rss+xml"/><pubDate>Fri, 22 Dec 2017 14:39:02 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Combine 2 texts line by line on Sun, 25 Apr 2021 17:22:21 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/195">@guy038</a> said in <a href="/post/28923">Combine 2 texts line by line</a>:</p>
<blockquote>
<p dir="auto">(?s)</p>
</blockquote>
<p dir="auto">thanks for such a valuable post. its working for me. how to merge 3 files.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/65306</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/65306</guid><dc:creator><![CDATA[Muppi Karthick]]></dc:creator><pubDate>Sun, 25 Apr 2021 17:22:21 GMT</pubDate></item><item><title><![CDATA[Reply to Combine 2 texts line by line on Mon, 02 Mar 2020 14:37:54 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/17884">@Fernando-Sorensen</a> made a <a href="https://community.notepad-plus-plus.org/topic/18993/combine-2-files-line-by-line">new post</a> which added an alternate idea; I have linked to it for future readers of this topic, so they don’t miss the separate post.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/51079</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/51079</guid><dc:creator><![CDATA[PeterJones]]></dc:creator><pubDate>Mon, 02 Mar 2020 14:37:54 GMT</pubDate></item><item><title><![CDATA[Reply to Combine 2 texts line by line on Tue, 26 Dec 2017 04:31:37 GMT]]></title><description><![CDATA[<p dir="auto">So <a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/10759">@wonkawilly</a> 's solution is a good one.  It is often forgotten that a column/rectangular selection isn’t really rectangular if some/all of its lines end before they hit the right edge of the block.  That is a key point that makes this solution viable.</p>
<p dir="auto">One “problem” with the solution is that it relies on the user to know that the column block to be copied is wide enough to capture the longest line.  If there are a lot of lines this becomes problematic as using the <strong>Begin / End Select</strong> techique discussed earlier is definitely the way to go.  But doing so creates uncertainty that the column block defined by the user at the last line of the file is truly wide enough.  Maybe a viable solution is to decide that a large number of columns (256?) will cover all situations likely to be encountered.</p>
<p dir="auto">So even better than remembering how to do this technique is recording it as a macro and having it always handy on the <strong>Macro</strong> menu.  I decided to give this a try.  I decided to do it as 2 macros.  It could be done as one macro with some extra effort…</p>
<p dir="auto">The first macro copies all data (up to 256 columns) in the current file to the clipboard as a column block. It looks like this:</p>
<pre><code>&lt;Macro name="Copy All Lines in Column Mode (max. 256 cols.)" Ctrl="no" Alt="no" Shift="no" Key="0"&gt;
    &lt;Action type="0" message="2316" wParam="0" lParam="0" sParam="" /&gt;
    &lt;Action type="2" message="0" wParam="42020" lParam="0" sParam="" /&gt;
    &lt;Action type="0" message="2318" wParam="0" lParam="0" sParam="" /&gt;
</code></pre>
<p dir="auto">Then <em><strong>REPEAT</strong></em> this line 256 times in the first macro:</p>
<pre><code>    &lt;Action type="0" message="2429" wParam="0" lParam="0" sParam="" /&gt;
</code></pre>
<p dir="auto">Then continue with this for the first macro:</p>
<pre><code>    &lt;Action type="2" message="0" wParam="42020" lParam="0" sParam="" /&gt;
    &lt;Action type="0" message="2178" wParam="0" lParam="0" sParam="" /&gt;
    &lt;Action type="2" message="0" wParam="42002" lParam="0" sParam="" /&gt;
    &lt;Action type="0" message="2345" wParam="0" lParam="0" sParam="" /&gt;
&lt;/Macro&gt;
</code></pre>
<p dir="auto">The second macro merges the column-block data in the clipboard into the current file as the file’s new odd-numbered lines. It looks like this:</p>
<pre><code>&lt;Macro name="Merge in Col. Block in Clipboard as Odd Numbered Lines" Ctrl="no" Alt="no" Shift="no" Key="0"&gt;
    &lt;Action type="0" message="2316" wParam="0" lParam="0" sParam="" /&gt;
    &lt;Action type="3" message="1700" wParam="0" lParam="0" sParam="" /&gt;
    &lt;Action type="3" message="1601" wParam="0" lParam="0" sParam="^" /&gt;
    &lt;Action type="3" message="1625" wParam="0" lParam="2" sParam="" /&gt;
    &lt;Action type="3" message="1602" wParam="0" lParam="0" sParam="\xff" /&gt;
    &lt;Action type="3" message="1702" wParam="0" lParam="768" sParam="" /&gt;
    &lt;Action type="3" message="1701" wParam="0" lParam="1609" sParam="" /&gt;
    &lt;Action type="0" message="2316" wParam="0" lParam="0" sParam="" /&gt;
    &lt;Action type="0" message="2179" wParam="0" lParam="0" sParam="" /&gt;
    &lt;Action type="3" message="1700" wParam="0" lParam="0" sParam="" /&gt;
    &lt;Action type="3" message="1601" wParam="0" lParam="0" sParam="\xff" /&gt;
    &lt;Action type="3" message="1625" wParam="0" lParam="2" sParam="" /&gt;
    &lt;Action type="3" message="1602" wParam="0" lParam="0" sParam="\r\n" /&gt;
    &lt;Action type="3" message="1702" wParam="0" lParam="768" sParam="" /&gt;
    &lt;Action type="3" message="1701" wParam="0" lParam="1609" sParam="" /&gt;
    &lt;Action type="0" message="2316" wParam="0" lParam="0" sParam="" /&gt;
&lt;/Macro&gt;
</code></pre>
<p dir="auto">I had one problem with recording the macro I originally wanted for the second macro.  I was attempting to get a zero-width column mode caret in column 1 for inserting a special character (I used hex FF as that special character) that would be replaced later with <code>\r\n</code>.  Unfortunately, what was recorded into the macro for this resulted in only a non-column caret on the last line of the file.  I didn’t delve too much into the macro source to see if I could work around this issue; rather I realized that a replace-all operation where one searches for <code>^</code> (beginning of line) and replaces that with the desired special character would work equivalently.</p>
<p dir="auto">So an example of this whole thing in action would be:</p>
<p dir="auto"><code>File 1</code> contents:</p>
<pre><code>aaaaaaaaaa
bbbbbbbbbbbbbbb
cccccccc
ddddddddd
eeeeeeeeeeeeeee
fffffffffffffffff
</code></pre>
<p dir="auto"><code>File 2</code> contents:</p>
<pre><code>11111111111111111111111
222222
3333333
444444444444
55555555
666
</code></pre>
<p dir="auto">With <code>File 1</code> active run the first macro (“Copy All Lines in Column Mode (max. 256 cols.)”).</p>
<p dir="auto">With <code>File 2</code> active run the second macro (“Merge in Col. Block in Clipboard as Odd Numbered Lines”).</p>
<p dir="auto"><code>File 2</code> contents after the merge (note <code>File 1</code> is unchanged):</p>
<pre><code>aaaaaaaaaa
11111111111111111111111
bbbbbbbbbbbbbbb
222222
cccccccc
3333333
ddddddddd
444444444444
eeeeeeeeeeeeeee
55555555
fffffffffffffffff
666
</code></pre>
]]></description><link>https://community.notepad-plus-plus.org/post/28964</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/28964</guid><dc:creator><![CDATA[Scott Sumner]]></dc:creator><pubDate>Tue, 26 Dec 2017 04:31:37 GMT</pubDate></item><item><title><![CDATA[Reply to Combine 2 texts line by line on Mon, 25 Dec 2017 09:33:10 GMT]]></title><description><![CDATA[<p dir="auto">Hi, <a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/374">@scott-sumner</a>,</p>
<p dir="auto">I agree with you, that the <strong>Begin/End select</strong> feature could be useful, dealing with <strong>large</strong> files !</p>
<p dir="auto">BTW, here is below, my method, <strong>slightly</strong> different from yours, to combine the <strong>Begin/End select</strong> feature and the <strong>column selection</strong> mode :</p>
<p dir="auto">Let’s start with the text, below :</p>
<pre><code class="language-diff">1 This a small example text
2 to s&gt;&lt;how how to do a
3 column selection with
4 the "Begin/End Sele&gt;&lt;ct"
5 feature of Notepad++
</code></pre>
<ul>
<li>
<p dir="auto"><strong>Left</strong> click at the position, between the <strong>two</strong> symbols <strong><code>&gt;&lt;</code></strong>, in line <strong><code>2</code></strong></p>
</li>
<li>
<p dir="auto">Execute a <strong>Edit &gt; Begin/End Select</strong> command</p>
</li>
<li>
<p dir="auto">Now, <strong>left</strong> click at the other position, between the <strong>two</strong> symbols <strong><code>&gt;&lt;</code></strong>, in line <strong><code>4</code></strong></p>
</li>
</ul>
<p dir="auto">Note that it’s the <strong>exact</strong> location where you want the <strong>column</strong> selection to be <strong>ended</strong> !</p>
<ul>
<li>
<p dir="auto">Hold down, <strong>simultaneously</strong>,  the <strong><code>Alt</code></strong>  and <strong><code>Shift</code></strong> keys and then hit the <strong>two</strong> keys <strong><code>Right Arrow</code></strong> then <strong><code>Left Arrow</code></strong>, to get a <strong>0-column</strong> selection</p>
</li>
<li>
<p dir="auto">Execute, again, a <strong>Edit &gt; Begin/End Select</strong> command</p>
</li>
</ul>
<p dir="auto">=&gt; The <strong>three</strong> lines <strong>column</strong> selection, below, is created :</p>
<pre><code class="language-diff">&lt;how how to do 
n selection wit
Begin/End Sele&gt;
</code></pre>
<p dir="auto">Cheers,</p>
<p dir="auto">guy038</p>
]]></description><link>https://community.notepad-plus-plus.org/post/28953</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/28953</guid><dc:creator><![CDATA[guy038]]></dc:creator><pubDate>Mon, 25 Dec 2017 09:33:10 GMT</pubDate></item><item><title><![CDATA[Reply to Combine 2 texts line by line on Mon, 25 Dec 2017 04:48:23 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/10743">@Honorata-Wisniewski</a> said:</p>
<blockquote>
<p dir="auto">Hi all!</p>
<p dir="auto">How can I combine 2 texts (or 2 files) in notepad++ line by line?</p>
<p dir="auto">Thus:<br />
1 line from text1 (or file1)<br />
1 line from text2 (or file2)<br />
2 line from text1 (or file1)<br />
2 line from text2 (or file2)<br />
…<br />
ect?</p>
<p dir="auto">Thanks!</p>
</blockquote>
<p dir="auto">I frequently face such a need and I usually do the following (I assure you it is more long to explicate than to do):</p>
<ol>
<li>I start by selecting the content of the first file with keyboard or mouse: I select it holding the Alt button on the keyboard to use the built-in N++ column selection mode;</li>
<li>I copy the selected text (Ctrl+c) to the clipboard;</li>
<li>Then I go to the second file at the first line;</li>
<li>Hold Alt+Shift keys and I go with the mouse or the keyboard down arrow to the last row at the EOF. Now I have a multi line keyboard cursor (that is the insertion point) blinking in my file;</li>
<li>I insert in the whole column previous selected a space-holder char (you can use any char that is not used into your file or even any string like “newlinehere”);</li>
<li>then I go to the first line, the first char of the row positioning the insert point prior of the space-holder;</li>
<li>Press Ctrl+v to paste the text from the clipboard;</li>
<li>Now I set a search for the place-holder and replace with \r\n;</li>
<li>Done.</li>
</ol>
<p dir="auto">Here is an <a href="https://streamable.com/mxv3n" rel="nofollow ugc">animation</a> that clarifies all steps. Unfortunately this community doesn’t accept file upload so I linked the external resource. Enjoy</p>
]]></description><link>https://community.notepad-plus-plus.org/post/28949</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/28949</guid><dc:creator><![CDATA[wonkawilly]]></dc:creator><pubDate>Mon, 25 Dec 2017 04:48:23 GMT</pubDate></item><item><title><![CDATA[Reply to Combine 2 texts line by line on Sun, 24 Dec 2017 20:13:44 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/195">@guy038</a></p>
<p dir="auto">There are 2 reasons I like to use <strong>Begin / End Select</strong> with the keyboard instead of the mouse:</p>
<ul>
<li>
<p dir="auto">When you have a large file, scrolling operations with the mouse take some effort/time; keyboard operations to jump to start of file (Ctrl+Home) and end of file (Ctrl+End) are quick.  In fact, Begin/End Select was probably created for keyboard users manipulating larger files.</p>
</li>
<li>
<p dir="auto">With the mouse, if you have a smaller font size enabled, it is kind of hard to hit an exact spot with the mouse in a single-click.  I find that as I’m also concentrating on doing Shift+Alt while doing it, it makes it slightly harder.  With the keyboard I know where I have the cursor/caret before I do the modifier keycombo, so no errant spot-hitting.</p>
</li>
</ul>
<p dir="auto">Of course, it is a personal preference.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/28946</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/28946</guid><dc:creator><![CDATA[Scott Sumner]]></dc:creator><pubDate>Sun, 24 Dec 2017 20:13:44 GMT</pubDate></item><item><title><![CDATA[Reply to Combine 2 texts line by line on Mon, 25 Dec 2017 08:23:01 GMT]]></title><description><![CDATA[<p dir="auto">Hi <a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/374">@Scott-sumner</a>,</p>
<p dir="auto">Sure that the <strong>Edit &gt; Begin/End</strong> menu command is interesting when the <strong>start</strong> of the <strong>selection</strong> is somewhere, <strong>inside</strong> the file, but, as we need a <strong>rectangular</strong> selection from the <strong>first</strong> digit of the <strong>first</strong> line, it could be realized even more simply :-)</p>
<p dir="auto">So, assuming you have some <strong>fixed width digit columns</strong>, at beginning of <strong>all</strong> lines of your file :</p>
<ul>
<li>
<p dir="auto">Move to the <strong>very beginning</strong> of the file ( <strong><code>Ctrl + Home</code></strong> )</p>
</li>
<li>
<p dir="auto">Then, drag down the <strong>vertical lift</strong>, on the <strong>right</strong> side of the editor window, to get the <strong>very end</strong> of the file</p>
</li>
<li>
<p dir="auto">Hold down, <strong>simultaneously</strong>,  the <strong><code>Alt</code></strong>  and <strong><code>Shift</code></strong> keys and, at the same time, <strong>left</strong> click, with the mouse, right <strong>after</strong> the <strong>last</strong> digit of the <strong>last</strong> line</p>
</li>
</ul>
<p dir="auto">=&gt; A <strong>rectangular</strong> selection, highlights <strong>all</strong> the digits, on the <strong>left</strong> side of the editor window</p>
<ul>
<li>
<p dir="auto">Hit the <strong><code>Delete</code></strong> key, to suppress the <strong>numbers</strong></p>
</li>
<li>
<p dir="auto">Hit the <strong><code>Left Arrow</code></strong> key, to delete the <strong>0 column</strong> selection and move back at the <strong>very beginning</strong> of the file</p>
</li>
</ul>
<p dir="auto">Et voilà !</p>
<hr />
<p dir="auto">This post, <strong>Scott</strong>, give me the opportunity to wish <strong>you</strong>, all <strong>N++ users</strong> , <strong>contributors</strong>  and @Don-HO, as well as your <strong>families</strong>, <strong><code>"O-O-O-O Merry Christmas O-O-O-O"</code></strong> !!!</p>
<p dir="auto">Cheers,</p>
<p dir="auto">guy038</p>
]]></description><link>https://community.notepad-plus-plus.org/post/28943</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/28943</guid><dc:creator><![CDATA[guy038]]></dc:creator><pubDate>Mon, 25 Dec 2017 08:23:01 GMT</pubDate></item><item><title><![CDATA[Reply to Combine 2 texts line by line on Sun, 24 Dec 2017 14:09:30 GMT]]></title><description><![CDATA[<p dir="auto">So I’m not one to try to oversell a solution I come up with, but mine was actually one that I could remember how to do if the need ever arises to do this type of 2-file merge.</p>
<p dir="auto">While the regex based solution is cool, elegant, etc., how could one possibly remember it?  One could document it or a link (to here) in a file, but then one would have to spend time searching for <em>THAT</em>.  Same goes for the Pythonscript; nice, but I’d have to keep track of it…for this very very occasional need.</p>
<p dir="auto">My solution did have a regex replacement component.  Hard to remember that one?  No, for those that are regex-worthy.  Yes, for those that are not.  So let’s eliminate that part (I’ve decided that the column-selection method I hinted at above is not too hard (to remember)):</p>
<h4>To remove the leading numbers put on in the column-editor step (non-regex version):</h4>
<ul>
<li>Move the cursor/caret to the top of the now-interleaved file with Ctrl+Home</li>
<li>Invoke <strong>Edit</strong> (menu) -&gt; <strong>Begin/End Select</strong> (a shame that this handy command has no default keycombo assigned!)</li>
<li>Move the cursor/caret to the bottom of the file with Ctrl+End</li>
<li>Move the caret to the LEFT side of the last digit to be removed near the start of the last line</li>
<li>Press Shift+Alt+RightArrow so that the last digit to be removed becomes highlighted (note that the addition of Alt to the keycombo makes this one-character selection a “column” selection–important to the next step!</li>
<li>Invoke <strong>Edit</strong> (menu) -&gt; <strong>Begin/End Select</strong> (all of the line-leading digits to be removed are now highlighted/selected (in a “column selection”</li>
<li>Tap the Delete key and <em>BOOM GOES THE DYNAMITE</em>–you are left with only the text you want to end up with–the interleaved files</li>
</ul>
]]></description><link>https://community.notepad-plus-plus.org/post/28939</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/28939</guid><dc:creator><![CDATA[Scott Sumner]]></dc:creator><pubDate>Sun, 24 Dec 2017 14:09:30 GMT</pubDate></item><item><title><![CDATA[Reply to Combine 2 texts line by line on Sat, 23 Dec 2017 13:17:46 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/10743">@Honorata-Wisniewski</a></p>
<p dir="auto">just in case you are interested in a python script way of doing it.</p>
<pre><code>from itertools import izip_longest

# create a list of lines from editor1 
editor1_list = editor1.getText().split()
# create a list of lines from editor2
editor2_list = editor2.getText().split()
#create the merged list (not really a list but an iterator)
resulting_list = izip_longest(editor1_list,editor2_list, fillvalue='')

# create new document
notepad.new()
# populate the merged list
editor.setText('\n'.join('\n'.join(x) for x in resulting_list))
</code></pre>
<p dir="auto">If the two documents do have different numbers of lines then this solution adds an empty line.<br />
Maybe useful (?)</p>
<p dir="auto">Cheers<br />
Claudia</p>
]]></description><link>https://community.notepad-plus-plus.org/post/28932</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/28932</guid><dc:creator><![CDATA[Claudia Frank]]></dc:creator><pubDate>Sat, 23 Dec 2017 13:17:46 GMT</pubDate></item><item><title><![CDATA[Reply to Combine 2 texts line by line on Fri, 22 Dec 2017 21:50:05 GMT]]></title><description><![CDATA[<p dir="auto">Hi, <a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/10743">@honorata-Wisniewski</a> and <strong>All</strong>,</p>
<p dir="auto">Ah yes, I forgot to point out that the <strong>last</strong> line, of the <strong>new</strong> tab contents ( The <strong><code>End of line 9</code></strong> in our example ) must be followed by a <strong>line-break</strong>. If you choose the menu option <strong>View &gt; Show Symbol &gt; Show all characters</strong>, the <strong>last</strong> line should be displayed as <strong><code>End of line 9</code>CRLF</strong> ( or <strong><code>End of line 9</code>LF</strong>, for <strong>Unix</strong> files ) and <strong>not</strong>, simply, as <strong><code>End of line 9</code></strong></p>
<p dir="auto">Indeed, if you do <strong>not</strong> add a <strong>line-break</strong> ( the regex <strong><code>\R</code></strong> ), the <strong>last</strong> part of my regex <strong><code>(^.*\R)</code></strong> <strong>cannot</strong> be matched and, consequently, the <strong>overall</strong> match, for the <strong>last</strong> line, because of the lack of the <strong>End of Line</strong> characters !</p>
<p dir="auto">Best Regards,</p>
<p dir="auto">guy038</p>
<p dir="auto"><strong>P.S.</strong> :</p>
<ul>
<li>
<p dir="auto">Remenber that the <strong>quantifier</strong> <strong><code>{9}</code></strong>, in the regexes, represents the exact <strong>number</strong> of lines of, <strong>both</strong> <strong><code>File1</code></strong> and <strong><code>File2</code></strong></p>
</li>
<li>
<p dir="auto">The <strong>separation</strong> line must begin by, at <strong>least</strong>, the string <strong><code>~~~</code></strong>, even if the <strong>surrounding</strong> lines begin with some <strong>blank</strong> characters</p>
</li>
</ul>
]]></description><link>https://community.notepad-plus-plus.org/post/28926</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/28926</guid><dc:creator><![CDATA[guy038]]></dc:creator><pubDate>Fri, 22 Dec 2017 21:50:05 GMT</pubDate></item><item><title><![CDATA[Reply to Combine 2 texts line by line on Fri, 22 Dec 2017 20:29:14 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/195">@guy038</a> said:</p>
<blockquote>
<p dir="auto">(?s)^~~~.+|(?-s)^.<em>\R(?=(?:.</em>\R){9}(^.*\R))</p>
</blockquote>
<p dir="auto">Thank you! It also works!<br />
But there is a little nuance here. Number of lines (in your example) shall be equal 20 (not 19). Line 20 can be empty<br />
Otherwise the last line “End of Line 9” disappear</p>
]]></description><link>https://community.notepad-plus-plus.org/post/28925</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/28925</guid><dc:creator><![CDATA[Honorata Wisniewski]]></dc:creator><pubDate>Fri, 22 Dec 2017 20:29:14 GMT</pubDate></item><item><title><![CDATA[Reply to Combine 2 texts line by line on Fri, 22 Dec 2017 20:13:52 GMT]]></title><description><![CDATA[<p dir="auto">Hi, <a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/10743">@honorata-Wisniewski</a>, <a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/374">@scott-sumner</a> and <strong>All</strong>,</p>
<p dir="auto">Oooooups ! I’ve just realized that my <strong>previous</strong> results are not exactly what <strong>Honorata</strong> would like to ! So, here is my <strong>second</strong> attempt :</p>
<p dir="auto">So, let’s use, again, the <strong>example</strong> text :</p>
<pre><code>Beginning of Line 1
Beginning of Line 2

Beginning of Line 4
Beginning of Line 5
Beginning of Line 6
Beginning of Line 7

Beginning of Line 9
~~~~~~~~~~~~~~~~~~~~
End of Line 1
End of Line 2
End of Line 3

End of Line 5
End of Line 6

End of Line 8
End of Line 9
</code></pre>
<p dir="auto">So, AFTER the following <strong>regex</strong> S/R :</p>
<p dir="auto">SEARCH : <strong><code>(?s)^~~~.+|(?-s)^.*\R(?=(?:.*\R){9}(^.*\R))</code></strong></p>
<p dir="auto">REPLACE : <strong><code>?1$0\1</code></strong></p>
<p dir="auto">You’ll get, this time, the <strong>expected</strong> text, below :</p>
<pre><code class="language-diff">Beginning of Line 1
End of Line 1
Beginning of Line 2
End of Line 2

End of Line 3
Beginning of Line 4

Beginning of Line 5
End of Line 5
Beginning of Line 6
End of Line 6
Beginning of Line 7


End of Line 8
Beginning of Line 9
End of Line 9
</code></pre>
<p dir="auto">Cheers,</p>
<p dir="auto">guy038</p>
]]></description><link>https://community.notepad-plus-plus.org/post/28924</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/28924</guid><dc:creator><![CDATA[guy038]]></dc:creator><pubDate>Fri, 22 Dec 2017 20:13:52 GMT</pubDate></item><item><title><![CDATA[Reply to Combine 2 texts line by line on Fri, 22 Dec 2017 21:14:48 GMT]]></title><description><![CDATA[<p dir="auto">Hello, <a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/10743">@honorata-Wisniewski</a>, <a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/374">@scott-sumner</a> and <strong>All</strong>,</p>
<p dir="auto">I found an <strong>easier</strong> method, which does <strong>not</strong> need <strong>column numbering</strong> nor <strong>sort</strong> operation :-)) It just uses… … a <strong>regex</strong> S/R !</p>
<p dir="auto">I, simply, assume two facts :</p>
<ul>
<li>
<p dir="auto">You have <strong>two</strong> tabs, in Notepad++, with the contents of <strong><code>File1</code></strong> and <strong><code>File2</code></strong></p>
</li>
<li>
<p dir="auto"><strong><code>File1</code></strong> and <strong><code>File2</code></strong> contain the <strong>same</strong> number <strong><code>n</code></strong> of lines</p>
</li>
</ul>
<p dir="auto">If so, follow these steps, below :</p>
<ul>
<li>
<p dir="auto">Open a <strong>new</strong> tab ( <strong><code>Ctrl + N</code></strong> )</p>
</li>
<li>
<p dir="auto">Select the contents of <strong><code>File1</code></strong> and <strong>paste</strong> them in this <strong>new</strong> tab</p>
</li>
<li>
<p dir="auto">Write a <strong>dummy</strong> line as, for instance, <strong><code>~~~~~~~~~~~~~~</code></strong> ( note that you must type in, at least, <strong>three</strong> <strong><code>~</code></strong> characters, at the <strong>beginning</strong> of line )</p>
</li>
<li>
<p dir="auto">Select the contents of <strong><code>File2</code></strong> and <strong>paste</strong> them, in the <strong>new</strong> tab, BELOW the <strong><code>~~~~~~~~~~~~~~</code></strong> line</p>
</li>
<li>
<p dir="auto">Open the <strong>Replace</strong> dialog ( <strong><code>Ctrl + H</code></strong> )</p>
</li>
</ul>
<p dir="auto">SEARCH <strong><code>(?s)^~~~.+|(?-s)^.*(?=\R(?:.*\R){n}(^.*))</code></strong> ( Just replace <strong><code>n</code></strong> with the <strong>appropriate</strong> number of lines )</p>
<p dir="auto">REPLACE <strong><code>?1$0\1</code></strong></p>
<p dir="auto">OPTIONS : <strong><code>Wrap Around</code></strong> and <strong><code>Regular expression</code></strong> set. <strong>All</strong> other options <strong>unticked</strong></p>
<p dir="auto">ACTION : Click on the <strong><code>Replace All</code></strong> button</p>
<p dir="auto">Et voilà ;-))</p>
<hr />
<p dir="auto"><strong>Remarks</strong> :</p>
<ul>
<li>
<p dir="auto">Some lines of <strong><code>File1</code></strong> and/or <strong><code>File2</code></strong> may be <strong>empty</strong> lines, <strong>without</strong> any problem</p>
</li>
<li>
<p dir="auto">I also noticed that <strong><code>File1</code></strong> may contain <strong>more</strong> lines than <strong><code>File2</code></strong>. In that case the number <strong><code>n</code></strong> represents the <strong>number</strong> of lines in <strong><code>File2</code></strong></p>
</li>
</ul>
<p dir="auto"><strong>Notes</strong> on the S/R :</p>
<ul>
<li>
<p dir="auto">The search regex has <strong>two</strong> alternatives :</p>
<ul>
<li>
<p dir="auto">The <strong><code>(?s)^~~~.+</code></strong> which represents the range of text, from the <strong>dummy</strong> line, included, till the <strong>very end</strong> of the file, which must be <strong>deleted</strong>, at the <strong>end</strong> of the process</p>
</li>
<li>
<p dir="auto">The <strong><code>(?-s)^.*(?=\R(?:.*\R){n}(^.*))</code></strong>, matches the contents of any line, even <strong>empty</strong>, of <strong><code>File1</code></strong>, if the contents of the <strong>look-ahead</strong> ( a condition ) <strong><code>\R(?:.*\R){n}(^.*)</code></strong> is <strong>true</strong>. That is to say if the current line is followed by a line-break, ( <strong><code>\R</code></strong> ) then by <strong><code>n</code></strong> <strong>complete</strong> lines, even <strong>empty</strong> in a <strong>non-capturing</strong> group ( <strong><code>(?:.*\R){n}</code></strong> ) , and, finally, by the contents of the next line, even <strong>empty</strong>, stored as <strong>group 1</strong>, due to the <strong>parentheses</strong> (  <strong><code>(^.*)</code></strong>  )</p>
</li>
</ul>
</li>
<li>
<p dir="auto">In <strong>replacement</strong> :</p>
<ul>
<li>
<p dir="auto">If <strong>group 1</strong> exists, we rewrite the <strong>matched</strong> line ( of <strong><code>File1</code></strong> ) ( <strong><code>$0</code></strong> ), followed by the the contents of <strong>group1</strong> ( <strong><code>\1</code></strong> ) ( corresponding line in <strong><code>File2</code></strong> )</p>
</li>
<li>
<p dir="auto">If <strong>group 1</strong> does <strong>not</strong> exist ( case of the <strong><code>1st</code></strong> alternative ) <strong>no</strong> text is rewritten and text from the <strong>dummy</strong> line till the <strong>end</strong> of file is just <strong>deleted</strong></p>
</li>
</ul>
</li>
</ul>
<hr />
<p dir="auto">Here is a <strong>practical</strong> example :</p>
<p dir="auto">Assuming <strong><code>File1</code></strong> contents ( <strong><code>9</code></strong> lines ) are :</p>
<pre><code class="language-diff">Beginning of Line 1
Beginning of Line 2

Beginning of Line 4
Beginning of Line 5
Beginning of Line 6
Beginning of Line 7

Beginning of Line 9
</code></pre>
<p dir="auto">and <strong><code>File2</code></strong> contents ( <strong><code>9</code></strong> lines ) are :</p>
<pre><code class="language-diff">End of Line 1
End of Line 2
End of Line 3

End of Line 5
End of Line 6

End of Line 8
End of Line 9
</code></pre>
<p dir="auto">Then the <strong>new</strong> tab contains the following text :</p>
<pre><code>Beginning of Line 1
Beginning of Line 2

Beginning of Line 4
Beginning of Line 5
Beginning of Line 6
Beginning of Line 7

Beginning of Line 9
~~~~~~~~~~~~~~~~~~~~
End of Line 1
End of Line 2
End of Line 3

End of Line 5
End of Line 6

End of Line 8
End of Line 9
</code></pre>
<p dir="auto">And AFTER the following <strong>regex</strong> S/R :</p>
<p dir="auto">SEARCH : <strong><code>(?s)^~~~.+|(?-s)^.*(?=\R(?:.*\R){9}(^.*))</code></strong></p>
<p dir="auto">REPLACE : <strong><code>?1$0\1</code></strong></p>
<p dir="auto">You should get, in the <strong>new</strong> tab, the resulting text :</p>
<pre><code class="language-diff">Beginning of Line 1End of Line 1
Beginning of Line 2End of Line 2
End of Line 3
Beginning of Line 4
Beginning of Line 5End of Line 5
Beginning of Line 6End of Line 6
Beginning of Line 7
End of Line 8
Beginning of Line 9End of Line 9
</code></pre>
<p dir="auto">Best Regards,</p>
<p dir="auto">guy038</p>
<p dir="auto"><strong>P.S.</strong> :</p>
<p dir="auto">See, also, a <strong>similar</strong> problem, in that post :</p>
<p dir="auto"><a href="https://notepad-plus-plus.org/community/topic/14944/macro-complex-instructions/8" rel="nofollow ugc">https://notepad-plus-plus.org/community/topic/14944/macro-complex-instructions/8</a></p>
]]></description><link>https://community.notepad-plus-plus.org/post/28923</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/28923</guid><dc:creator><![CDATA[guy038]]></dc:creator><pubDate>Fri, 22 Dec 2017 21:14:48 GMT</pubDate></item><item><title><![CDATA[Reply to Combine 2 texts line by line on Fri, 22 Dec 2017 15:47:25 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/10743">@Honorata-Wisniewski</a></p>
<p dir="auto">It is not a very commonly needed thing to do, so it is “complicated”.</p>
<p dir="auto">You can avoid the <strong>Replace All</strong> operation by using the <strong>Begin/End Select</strong> function to select the leading numbers to remove, but that is tougher to explain for column mode use (which would be needed here–assuming you have a lot of lines of data); it does simplify it a bit, though.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/28916</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/28916</guid><dc:creator><![CDATA[Scott Sumner]]></dc:creator><pubDate>Fri, 22 Dec 2017 15:47:25 GMT</pubDate></item><item><title><![CDATA[Reply to Combine 2 texts line by line on Fri, 22 Dec 2017 15:42:51 GMT]]></title><description><![CDATA[<p dir="auto">Thank you very much!</p>
<p dir="auto">It worked!!!</p>
<p dir="auto">It’s quite a complicated way (thought it should be simple), but it worked!</p>
]]></description><link>https://community.notepad-plus-plus.org/post/28915</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/28915</guid><dc:creator><![CDATA[Honorata Wisniewski]]></dc:creator><pubDate>Fri, 22 Dec 2017 15:42:51 GMT</pubDate></item><item><title><![CDATA[Reply to Combine 2 texts line by line on Fri, 22 Dec 2017 15:02:06 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/10743">@Honorata-Wisniewski</a></p>
<p dir="auto">Definitely go with two files, file1 and file2…not sure what text1 and text2 means anyway. :-D</p>
<p dir="auto">In file1, move the caret/cursor to the very top of the file.  Press Alt+c to invoke the column-editor; set it up this way and then press OK:</p>
<p dir="auto"><img src="https://camo.nodebb.org/30c4c378b18a70c0e0ba95dcd2d6c32ce9abc7cb?url=https%3A%2F%2Fi.imgur.com%2FhnCP9iv.png" alt="Imgur" class=" img-fluid img-markdown" /></p>
<p dir="auto">Repeat the same series of actions for file2.</p>
<p dir="auto">Copy complete text of file2 into file1 below file1’s existing text.  Or better, move the text of both files into a 3rd editing tab, just be sure to have the file1 contents <em>above</em> the file2 data.</p>
<p dir="auto">In the file with the combined data, do a line sort ascending operation from the <strong>Edit</strong> (menu) -&gt; <strong>Line Operations…</strong> choices.</p>
<p dir="auto">To remove the leading numbers put on in the column-editor step by the following:</p>
<p dir="auto">Invoke the Replace dialog (Ctrl+h).</p>
<p dir="auto"><strong>Find-what</strong> zone: <code>(?-s)^.{4}(.*?\R)</code> where 4 is just an example–use how many ever digits you need to remove from the start of your lines<br />
<strong>Replace-with</strong> zone: <code>\1</code><br />
Tick the <strong>Wrap around</strong> box<br />
Set the <strong>Search mode</strong> to <code>Regular Expression</code><br />
Press the <strong>Replace All</strong> button</p>
]]></description><link>https://community.notepad-plus-plus.org/post/28911</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/28911</guid><dc:creator><![CDATA[Scott Sumner]]></dc:creator><pubDate>Fri, 22 Dec 2017 15:02:06 GMT</pubDate></item></channel></rss>