<?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[Sorting with a "column mode" selection]]></title><description><![CDATA[<p dir="auto">Hello, <strong>All</strong>,</p>
<p dir="auto">My God ! Although I’ve practiced the <strong>Notepad++</strong> software since <strong>many</strong> years; do you know that I have <strong>not</strong> realized, yet, that we can sort text :</p>
<ul>
<li>
<p dir="auto">From a <strong>specific</strong> column till the <strong>end</strong> of line, with a <strong><code>zero-char</code> column</strong> selection</p>
</li>
<li>
<p dir="auto">From a <strong><code>n-chars</code></strong> key, between <strong>two</strong> columns, with a <strong><code>non-zero</code> column</strong> selection</p>
</li>
</ul>
<p dir="auto">I really do <strong>not</strong> understand how I could <strong>miss</strong> this important feature, for <strong>years</strong> :-(( Indeed, after verifications, this nice improvement exists since N++ version <strong><code>v6.7.9</code></strong>, which came out in <strong><code>June 2015 !</code></strong></p>
<p dir="auto">It is these <strong>two</strong> lines, in the <strong><code>change.log</code></strong> file, of the <strong>last</strong> <strong><code>v7.9</code></strong> version, which <strong>alerted</strong> me about a possible <strong>unknown</strong> feature ( for me ) !</p>
<pre><code class="language-z">19. Fix column key sort with col block starting in col1 bug.
24. Fix sorting by column key using incorrect key values.
</code></pre>
<p dir="auto">My <strong>ignorance</strong> of this feature explains why I proposed, in some posts, a <strong>work-around</strong>, based on <strong>regular</strong> expressions !!</p>
<hr />
<p dir="auto">However, note that, in some cases, the use of a <strong><code>n-chars</code> column</strong> selection or <strong>regex</strong> solutions do <strong>not</strong> give the <strong>same</strong> sort order ! For instance, let’s consider these lines, <strong>without</strong> their leading numbers, extracted from the <strong><code>change.log</code></strong> file of the <strong>last</strong> version :</p>
<pre><code class="language-diff">Add the ability to open the target file of a Shortcut (*.lnk).
Add back hovered blue underlined URLs.
Add an option to prevent right click from canceling selection.
Add ability to sort lines randomly.
Add word wrap option to find results context menu.
Add keyboard navigation ability to Column Editor.
Add keyboard shortcuts for switching to panels.
Add confirmation preference for Replace All in All Opened Documents operation.
Add Escape keypress in functionlist searchbox to clear its text.
Add RTL capability to localized messageboxes.
Add search scope to Find window status bar output.
</code></pre>
<ul>
<li>If we create a <strong><code>11 × 3 column</code></strong> selection, from <strong><code>column 1</code></strong> and, then, use the option <strong><code>Edit &gt; Line Operations &gt; Sort lines Lexicographically Ascending</code></strong>, <strong>nothing</strong> has changed  ! Logical : as the <strong>key</strong> <strong><code>Add</code></strong> is <strong>identical</strong> for <strong>all</strong> these lines, the <strong>initial</strong> order of the lines is simply <strong>kept</strong> !</li>
</ul>
<hr />
<ul>
<li>
<p dir="auto">Now, let’s imagine that I create a <strong>pseudo</strong>-key, from text between column <strong><code>1</code></strong> and <strong><code>3</code></strong>, that I place <strong>before</strong> any text of each line, for <strong>further</strong> sorting, based on that <strong>pseudo-key</strong>. We can use the simple <strong>regex</strong> S/R :</p>
<ul>
<li>
<p dir="auto">SEARCH <strong><code>(?-s)^(...).+</code></strong></p>
</li>
<li>
<p dir="auto">REPLACE <strong><code>\1\t$0</code></strong></p>
</li>
</ul>
</li>
</ul>
<p dir="auto">giving this list :</p>
<pre><code class="language-diff">Add	Add the ability to open the target file of a Shortcut (*.lnk).
Add	Add back hovered blue underlined URLs.
Add	Add an option to prevent right click from canceling selection.
Add	Add ability to sort lines randomly.
Add	Add word wrap option to find results context menu.
Add	Add keyboard navigation ability to Column Editor.
Add	Add keyboard shortcuts for switching to panels.
Add	Add confirmation preference for Replace All in All Opened Documents operation.
Add	Add Escape keypress in functionlist searchbox to clear its text.
Add	Add RTL capability to localized messageboxes.
Add	Add search scope to Find window status bar output.
</code></pre>
<p dir="auto">If we do a <strong>normal</strong> ( stream ) selection of these <strong><code>11</code></strong> lines and run the <strong>same</strong> sort, we get, this time :</p>
<pre><code class="language-diff">Add	Add Escape keypress in functionlist searchbox to clear its text.
Add	Add RTL capability to localized messageboxes.
Add	Add ability to sort lines randomly.
Add	Add an option to prevent right click from canceling selection.
Add	Add back hovered blue underlined URLs.
Add	Add confirmation preference for Replace All in All Opened Documents operation.
Add	Add keyboard navigation ability to Column Editor.
Add	Add keyboard shortcuts for switching to panels.
Add	Add search scope to Find window status bar output.
Add	Add the ability to open the target file of a Shortcut (*.lnk).
Add	Add word wrap option to find results context menu.
</code></pre>
<ul>
<li>
<p dir="auto">And, after <strong>deleting</strong> this leading <strong>pseudo-key</strong> with the S/R :</p>
<ul>
<li>
<p dir="auto">SEARCH <strong><code>(?-s)^.+\t</code></strong></p>
</li>
<li>
<p dir="auto">REPLACE <strong><code>Leave Empty</code></strong></p>
</li>
</ul>
</li>
</ul>
<p dir="auto">We get our final <strong>sorted</strong> text :</p>
<pre><code class="language-diff">Add Escape keypress in functionlist searchbox to clear its text.
Add RTL capability to localized messageboxes.
Add ability to sort lines randomly.
Add an option to prevent right click from canceling selection.
Add back hovered blue underlined URLs.
Add confirmation preference for Replace All in All Opened Documents operation.
Add keyboard navigation ability to Column Editor.
Add keyboard shortcuts for switching to panels.
Add search scope to Find window status bar output.
Add the ability to open the target file of a Shortcut (*.lnk).
Add word wrap option to find results context menu.
</code></pre>
<p dir="auto">It’s obvious that, in this <strong>second</strong> solution, anything, after the leading <strong><code>Add</code></strong> word, is <strong>also</strong> sorted, giving a <strong>different</strong> order !</p>
<p dir="auto">If we <strong>extend</strong> this reasoning to a sorting with <strong>several</strong> keys ( solution possible with <strong>regexes</strong> but impossible with <strong>column</strong> selection as we <strong>cannot</strong> define <strong>multiple column</strong> selections ), this means that, in case that some lines have <strong>same</strong> sorting key(s), these lines are, then, normally <strong>sorted</strong> on their entire <strong>contents</strong></p>
<p dir="auto">But, the behaviour of <strong>N++</strong> sort, with a <strong>column</strong> selection, is also interesting as it keeps lines in their <strong>original</strong> order , in case of an <strong>equal</strong> sorting key !</p>
<p dir="auto">Best regards,</p>
<p dir="auto">guy038</p>
]]></description><link>https://community.notepad-plus-plus.org/topic/20043/sorting-with-a-column-mode-selection</link><generator>RSS for Node</generator><lastBuildDate>Tue, 10 Nov 2026 21:57:32 GMT</lastBuildDate><atom:link href="https://community.notepad-plus-plus.org/topic/20043.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 23 Sep 2020 21:35:01 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Sorting with a "column mode" selection on Fri, 25 Sep 2020 04:11:13 GMT]]></title><description><![CDATA[<p dir="auto">Hello,<a class="plugin-mentions-user plugin-mentions-a" href="/user/guy038" aria-label="Profile: guy038">@<bdi>guy038</bdi></a><br />
Follow this steps,To Sorting with a “column mode” selection</p>
<p dir="auto"><strong>Step 1:-</strong> <strong>Line Up Columns using the TextFX Plugin</strong></p>
<p dir="auto"><strong>Step 1 :-</strong>  Select the pipe (|) character that separates the “columns” and copy it to the clipboard:<br />
<strong>Step 2 :-</strong> Select all the text and use Line up multiple lines by (Clipboard Character):<br />
<strong>Step 3 :-</strong> We have now lined up the text using the pipe (|) character to make it look like a table with columns</p>
<p dir="auto"><strong>Step 2:-</strong> <strong>Move and Sort Columns</strong></p>
<p dir="auto"><strong>Step 4:-</strong> Use Alt+Mouse Dragging or Alt+Shift+Arrows to select the “colums” you want to move.</p>
<p dir="auto"><strong>Step 5:-</strong> Drag the columns to the start of the first line. You can also Cut (CTRL+X) the selected columns, move the caret to the start of the first line, then Paste (CTRL+V) the columns there.</p>
<p dir="auto"><strong>Step 6:-</strong> Select all the text and use Sort Lines Lexicographically Ascending:</p>
<p dir="auto"><strong>Step 7:-</strong> We have now sorted the text alphabetically by the first “columns”:</p>
<p dir="auto">I hope this information will be usefull for you.<br />
Thank you.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/57910</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/57910</guid><dc:creator><![CDATA[Makwana Prahlad]]></dc:creator><pubDate>Fri, 25 Sep 2020 04:11:13 GMT</pubDate></item><item><title><![CDATA[Reply to Sorting with a "column mode" selection on Thu, 24 Sep 2020 13:20:17 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/peterjones" aria-label="Profile: PeterJones">@<bdi>PeterJones</bdi></a> <a class="plugin-mentions-user plugin-mentions-a" href="/user/guy038" aria-label="Profile: guy038">@<bdi>guy038</bdi></a></p>
<blockquote>
<p dir="auto">What do you guys think if I added a bullet point to the Line Operations sorting-algorithm list?</p>
</blockquote>
<p dir="auto">👍</p>
<p dir="auto">Okay, so now I’m wondering how it is that <em><strong>I</strong></em> knew about it before this?</p>
<p dir="auto">It seems like I’ve always known about it, but I wasn’t born knowing it…</p>
<p dir="auto">I think it might have come from the bowels of this thread and the scripting that was derived from it:  <a href="https://community.notepad-plus-plus.org/topic/14129/sort-file-removing-duplicates-possible/">https://community.notepad-plus-plus.org/topic/14129/sort-file-removing-duplicates-possible/</a></p>
<p dir="auto">but again, not sure…</p>
]]></description><link>https://community.notepad-plus-plus.org/post/57891</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/57891</guid><dc:creator><![CDATA[Alan Kilborn]]></dc:creator><pubDate>Thu, 24 Sep 2020 13:20:17 GMT</pubDate></item><item><title><![CDATA[Reply to Sorting with a "column mode" selection on Thu, 24 Sep 2020 13:14:47 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/alan-kilborn" aria-label="Profile: Alan-Kilborn">@<bdi>Alan-Kilborn</bdi></a> said in <a href="/post/57884">Sorting with a "column mode" selection</a>:</p>
<blockquote>
<p dir="auto">I didn’t see anything about sorting in there</p>
</blockquote>
<p dir="auto">That is being rectified to a certain extent – <a href="https://github.com/notepad-plus-plus/npp-usermanual/pull/118/files" rel="nofollow ugc">PR#118</a> was just accepted and merged a few days ago, so will be in the next release of the <a href="http://npp-user-manual.org" rel="nofollow ugc">npp-user-manual.org</a> website.</p>
<p dir="auto">However, since I also didn’t know that sorting works in column mode until this topic, that wasn’t mentioned there.  What do you guys think if I added a bullet point to the Line Operations sorting-algorithm list:</p>
<ul>
<li>If a <a href="./#column-mode-column-editor">Column Mode</a> selection is active, the sort will re-order all the lines included in the selection, but the sort key (the text that decides the sort order) will be limited to what is inside the column selection.  If the keys are identical on two lines, then the order of those two lines will not change (even if text outside of the selected key columns is different).</li>
</ul>
]]></description><link>https://community.notepad-plus-plus.org/post/57888</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/57888</guid><dc:creator><![CDATA[PeterJones]]></dc:creator><pubDate>Thu, 24 Sep 2020 13:14:47 GMT</pubDate></item><item><title><![CDATA[Reply to Sorting with a "column mode" selection on Thu, 24 Sep 2020 12:07:05 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/57871">Sorting with a "column mode" selection</a>:</p>
<blockquote>
<p dir="auto">do you know that I have not realized, yet, that we can sort text…</p>
</blockquote>
<p dir="auto">Welcome to the party. :-)</p>
<p dir="auto">I thought I would find info about this in the user manual, but I didn’t see anything about sorting in there; probably I am just not good at navigating the user manual. :-(</p>
<blockquote>
<p dir="auto">…as the key Add is identical for all these lines, the initial order of the lines is simply kept !</p>
</blockquote>
<blockquote>
<p dir="auto">the behaviour of N++ sort, with a column selection, is also interesting as it keeps lines in their original order , in case of an equal sorting key !</p>
</blockquote>
<p dir="auto">This is what is known as a “stable” sort.  Some sort algorithms will mix up the original order when the key field is the same.  Not, apparently, the N++ sort algo.</p>
<blockquote>
<p dir="auto">I create a pseudo-key, from text between column 1 and 3, that I place before any text of each line, for further sorting,</p>
</blockquote>
<p dir="auto">Seems pointless, as <code>Add</code> already leads off every line, but I think I get your point:  If you wanted some variable data from each line, from a point embedded <em>deeper</em> into the liens…</p>
]]></description><link>https://community.notepad-plus-plus.org/post/57884</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/57884</guid><dc:creator><![CDATA[Alan Kilborn]]></dc:creator><pubDate>Thu, 24 Sep 2020 12:07:05 GMT</pubDate></item></channel></rss>