<?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[Organizing data]]></title><description><![CDATA[<p dir="auto">Hello, I have data that is in long rows, but I need to make different columns while keeping the rows in the certain order.</p>
<p dir="auto">For example, I have this:<br />
ospht421     	4.52E-02	-1.20E-02	2.98E-03	3.19E-02	-1.93E-02	-6.87E-02	4.16E-02	1.71E-02	  -2087	2.95E-02</p>
<p dir="auto">And I need it to look like this:<br />
ospht421     	<br />
4.52E-02  	-1.20E-02	2.98E-03	<br />
3.19E-02	         -1.93E-02	-6.87E-02	<br />
4.16E-02	         1.71E-02	-2082.95E-02</p>
<p dir="auto">I have a lot of data and it takes forever to do it by hand. Any advice would be appreciated!</p>
<p dir="auto">Thanks,<br />
Kim</p>
]]></description><link>https://community.notepad-plus-plus.org/topic/11802/organizing-data</link><generator>RSS for Node</generator><lastBuildDate>Wed, 10 Jun 2026 08:42:42 GMT</lastBuildDate><atom:link href="https://community.notepad-plus-plus.org/topic/11802.rss" rel="self" type="application/rss+xml"/><pubDate>Mon, 16 May 2016 05:21:43 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Organizing data on Tue, 17 May 2016 19:58:27 GMT]]></title><description><![CDATA[<p dir="auto">Hi <strong>Kim</strong>,</p>
<p dir="auto">From your reply, it happens that one <strong>SPACE</strong> should be <strong>present</strong>, in the <strong>search</strong> regex, between the <strong>opening</strong> round bracket and the block <strong><code>[+-]</code></strong> !</p>
<p dir="auto">Well, I just realized that your <strong>numbers</strong> could be separated by <strong>more</strong> than one <strong>space</strong> characters ! Moreover, your file may, also, contain some <strong>tabulation</strong> characters. In that case, prefer the <strong>search</strong> regex  below ( The replacement regex is <strong>unchanged</strong> ):</p>
<p dir="auto"><strong><code>(\h+[+-]?\d+(\.(\d+)?)?[Ee][+-]\d\d){3}</code></strong></p>
<p dir="auto"><strong>Notes</strong> :</p>
<ul>
<li>
<p dir="auto">The <strong><code>\h</code></strong> regex syntax matches one <strong>horizontal blank</strong> character, that is to say :</p>
<ul>
<li>
<p dir="auto">The <strong>normal space</strong> character ( <strong><code>\x20</code></strong> )</p>
</li>
<li>
<p dir="auto">The <strong>tabulation</strong> character ( <strong><code>\x09</code></strong> )</p>
</li>
<li>
<p dir="auto">The <strong>No-Break</strong> space ( abbreviated <strong>NBSP</strong> ) ( <strong><code>\xA0</code></strong> )</p>
</li>
</ul>
</li>
<li>
<p dir="auto">As usual, the <strong><code>+</code></strong> quantifier means <strong>one or more</strong> times the <strong>previous</strong> character</p>
</li>
</ul>
<hr />
<p dir="auto">So given the <strong>test</strong> example below, where I put, between numbers, several <strong>spaces</strong>, in the <strong>first</strong> line, several <strong>tabulations</strong> in the <strong>second</strong> line and a <strong>mix</strong> of these two, in the <strong>third</strong> line :</p>
<pre><code>    ospht421 4.52E-02     -1.20E-02 2.98E-03          3.19E-02             -1.93E-02 -6.87E-02 4.16E-02 1.71E-02 -2082.95E-02

ospht000	+9.9999998E+03	+1.23e-07	-5.4625e+04	-6.258E-00	5.789E+02	1.008E-06	+9.E+03	+1.E-07	-5.e+04

        ospht999         		-6.E-00 5.E+02			        1.e-06 +9E+03 +1e-07 -5E+04    		    	-6e-00 5E+02 1E-06
</code></pre>
<p dir="auto">After clicking on the <strong>Replace All</strong> button, we get the following text :</p>
<pre><code>        ospht421
 4.52E-02     -1.20E-02 2.98E-03
          3.19E-02             -1.93E-02 -6.87E-02
 4.16E-02 1.71E-02 -2082.95E-02
    
    ospht000
	+9.9999998E+03	+1.23e-07	-5.4625e+04
	-6.258E-00	5.789E+02	1.008E-06
	+9.E+03	+1.E-07	-5.e+04
    
            ospht999
         		-6.E-00 5.E+02			        1.e-06
 +9E+03 +1e-07 -5E+04
    		    	-6e-00 5E+02 1E-06
</code></pre>
<p dir="auto">Now, we have to get rid of <strong>all</strong> the possible <strong>blanks</strong> characters, at the <strong>beginning</strong> of the lines and just keep one <strong>space</strong> character between the different <strong>numbers</strong>. The following <strong>S/R</strong> will achieve it, nicely :</p>
<p dir="auto">Find what : <strong><code>^\h+|(\h+)</code></strong></p>
<p dir="auto">Replace with :  <strong><code>(?1 )</code></strong> , with a <strong>space</strong> after the <strong>digit</strong> 1</p>
<p dir="auto"><strong>Notes</strong> :</p>
<ul>
<li>
<p dir="auto">Due to the <strong>alternative</strong> regex symbol <strong><code>|</code></strong>, this <strong>search</strong> regex looks :</p>
<ul>
<li>
<p dir="auto">for any <strong>non null</strong> range of <strong>blank</strong> characters, that begins the line ( the <strong><code>^</code></strong> symbol represents the <strong>zero length</strong> assertion <strong>beginning of line</strong> )</p>
</li>
<li>
<p dir="auto">for any <strong>subsequent</strong> range of these <strong>blank</strong> characters, between the <strong>numbers</strong></p>
</li>
</ul>
</li>
<li>
<p dir="auto">The second part <strong><code>(\h+)</code></strong>, ( the <strong>subsequent blanks</strong> ), is enclosed in <strong>round</strong> brackets, and represents the <strong>group 1</strong></p>
</li>
<li>
<p dir="auto">In replacement, we use the <strong>conditional</strong> form <strong><code>(?n....)</code></strong> :</p>
<ul>
<li>
<p dir="auto">which replace the <strong>searched</strong> regex with the string located after <strong>digit</strong> <strong><code>n</code></strong> , till the <strong>ending</strong> round bracket, if the group <strong><code>n</code></strong> exists</p>
</li>
<li>
<p dir="auto">which does <strong>NO</strong> replacement if the group <strong><code>n</code></strong> does <strong>NOT</strong> exist</p>
</li>
</ul>
</li>
</ul>
<p dir="auto">So :</p>
<ul>
<li>
<p dir="auto">When the first part, of the <strong>search</strong> regex, matches possible <strong>blank</strong> characters, at <strong>beginning</strong> of a line, <strong>group 1</strong>, does <strong>not</strong> exist. Therefore, there’s <strong>NO</strong> replacement</p>
</li>
<li>
<p dir="auto">When the second part, of the <strong>search</strong> regex, matches <strong>blank</strong> characters, before the <strong>numbers</strong>, <strong>group 1</strong> exists. Then they are replaced with the <strong>single</strong> space, located between the <strong>digit 1</strong> and the <strong>ending round</strong> bracket, of the <strong>replacement</strong> regex</p>
</li>
</ul>
<p dir="auto">This time, after performing this <strong>second</strong> S/R, we obtain the <strong>final</strong> text below :</p>
<pre><code>ospht421
4.52E-02 -1.20E-02 2.98E-03
3.19E-02 -1.93E-02 -6.87E-02
4.16E-02 1.71E-02 -2082.95E-02

ospht000
+9.9999998E+03 +1.23e-07 -5.4625e+04
-6.258E-00 5.789E+02 1.008E-06
+9.E+03 +1.E-07 -5.e+04

ospht999
-6.E-00 5.E+02 1.e-06
+9E+03 +1e-07 -5E+04
-6e-00 5E+02 1E-06
</code></pre>
<p dir="auto">Cheers,</p>
<p dir="auto">guy038</p>
]]></description><link>https://community.notepad-plus-plus.org/post/15979</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/15979</guid><dc:creator><![CDATA[guy038]]></dc:creator><pubDate>Tue, 17 May 2016 19:58:27 GMT</pubDate></item><item><title><![CDATA[Reply to Organizing data on Tue, 17 May 2016 16:50:28 GMT]]></title><description><![CDATA[<p dir="auto">Thanks, guy038!</p>
<p dir="auto">I have never used Notepad++ before, so I am not familiar with how to use it. I have tried your suggestion in the Replace box but it say there are 0 replacements.</p>
<p dir="auto">Find what: ([±]?\d+(.(\d+)?)?[Ee][±]\d\d){3}<br />
Replace with: \r\n$0<br />
And the Regular Expression box is ticked.</p>
<p dir="auto">I am sure it is just a silly mistake on my part, but I can’t seem to get it working.</p>
<p dir="auto">Thanks!<br />
Kim</p>
]]></description><link>https://community.notepad-plus-plus.org/post/15973</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/15973</guid><dc:creator><![CDATA[Kimberly Plomp]]></dc:creator><pubDate>Tue, 17 May 2016 16:50:28 GMT</pubDate></item><item><title><![CDATA[Reply to Organizing data on Mon, 16 May 2016 11:55:17 GMT]]></title><description><![CDATA[<p dir="auto">Hello <strong>Kimberly Plomp</strong>,</p>
<p dir="auto">Once more, this kind of modification of text can be easily achieved with <strong>regular</strong> expressions !</p>
<p dir="auto">At first sight, your text seems to contain a list of numbers, in the classical <strong>E scientific</strong> notation ! Am I right ?</p>
<p dir="auto">I supposed so. Therefore, I, <strong>first</strong>, tried to build a regex, in order to match such numbers. Taking in account, <strong>all</strong> the different syntaxes for these numbers, with an example below :</p>
<pre><code>+9.9999998E+03
+1.23e-07
-5.4625e+04
-6.258E-00
5.789E+02
1.008E-06

+9.E+03
+1.E-07
-5.e+04
-6.E-00
5.E+02
1.e-06

+9E+03
+1e-07
-5E+04
-6e-00
5E+02
1E-06
</code></pre>
<p dir="auto">I got this regex : <strong><code>[+-]?\d+(\.(\d+)?)?[Ee][+-]\d\d</code></strong></p>
<ul>
<li>
<p dir="auto">The part <strong><code>[+-]?</code></strong> matches an optional sign ( remain that the regex quantifier <strong><code>?</code></strong> means <strong>0 or 1</strong> time )</p>
</li>
<li>
<p dir="auto">The part <strong><code>\d+</code></strong> matches the <strong>mantissa</strong> part, <strong>before</strong> the dot ( The regex quantifier <strong><code>+</code></strong> means <strong>1 or more</strong> time(s) )</p>
</li>
<li>
<p dir="auto">The part <strong><code>(\.(\d+)?)?</code></strong> represents the <strong>optional fractional</strong> part of a number, itself composed of a dot <strong><code>\.</code></strong> ( which must be <strong>escaped</strong> as it’s a <strong>meta</strong> character in regexes ) and an <strong>optional</strong> digits <strong><code>(\d+)?</code></strong>, <strong>after</strong> the dot</p>
</li>
<li>
<p dir="auto">The part <strong><code>[Ee]</code></strong> matches the <strong>E notation</strong> letter, whatever the <strong>case</strong></p>
</li>
<li>
<p dir="auto">The part <strong><code>[+-]</code></strong> matches the <strong>mandatory</strong> sign</p>
</li>
<li>
<p dir="auto">The part <strong><code>\d\d</code></strong> represents the <strong>two</strong> digits of the <strong>exponent</strong></p>
</li>
</ul>
<p dir="auto">Right. Now, from your text, below :</p>
<pre><code>ospht421 4.52E-02 -1.20E-02 2.98E-03 3.19E-02 -1.93E-02 -6.87E-02 4.16E-02 1.71E-02 -2082.95E-02
</code></pre>
<p dir="auto">We notice that any <strong>E notation</strong> number is preceded by a <strong>space</strong>. So, as you expect to split on <strong>several</strong> lines, <strong>every 3</strong> numbers, we can build the <strong>final</strong> search regex <strong><code>( [+-]?\d+(\.(\d+)?)?[Ee][+-]\d\d){3}</code></strong>, which will matches <strong>3 numbers</strong></p>
<ul>
<li>
<p dir="auto">Enclosed in <strong>round</strong> brackets, it begins with a <strong>space</strong> and ends with the <strong><code>{3}</code></strong> quantifier</p>
</li>
<li>
<p dir="auto">The replacement part <strong><code>\r\n$0</code></strong> will replace this <strong>range</strong> of numbers by an Windows <strong>End of Line</strong> characters <strong><code>\r\n</code></strong>, followed by the <strong>entire</strong> regex matched <strong><code>$0</code></strong></p>
</li>
<li>
<p dir="auto">Don’t forget, in the <strong>Replace</strong> dialog, to set the <strong>Regular expression</strong> search mode !</p>
</li>
</ul>
<p dir="auto">So , from the <strong>test</strong> example, below</p>
<pre><code>ospht421 4.52E-02 -1.20E-02 2.98E-03 3.19E-02 -1.93E-02 -6.87E-02 4.16E-02 1.71E-02 -2082.95E-02

ospht000 +9.9999998E+03 +1.23e-07 -5.4625e+04 -6.258E-00 5.789E+02 1.008E-06 +9.E+03 +1.E-07 -5.e+04

ospht999 -6.E-00 5.E+02 1.e-06 +9E+03 +1e-07 -5E+04 -6e-00 5E+02 1E-06
</code></pre>
<p dir="auto">After clicking on the <strong>Replace All</strong> button, we get the <strong>new</strong> text :</p>
<pre><code>ospht421
 4.52E-02 -1.20E-02 2.98E-03
 3.19E-02 -1.93E-02 -6.87E-02
 4.16E-02 1.71E-02 -2082.95E-02

ospht000
 +9.9999998E+03 +1.23e-07 -5.4625e+04
 -6.258E-00 5.789E+02 1.008E-06
 +9.E+03 +1.E-07 -5.e+04

ospht999
 -6.E-00 5.E+02 1.e-06
 +9E+03 +1e-07 -5E+04
 -6e-00 5E+02 1E-06
</code></pre>
<p dir="auto">Possibly, to get rid of the <strong>leading</strong> space(s), just use the simple <strong>search</strong> regex <strong><code>^ +</code></strong> and leave the <strong>replacement</strong> zone <strong>empty</strong></p>
<p dir="auto">Et voilà !</p>
<p dir="auto">Best Regards,</p>
<p dir="auto">guy038</p>
]]></description><link>https://community.notepad-plus-plus.org/post/15949</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/15949</guid><dc:creator><![CDATA[guy038]]></dc:creator><pubDate>Mon, 16 May 2016 11:55:17 GMT</pubDate></item></channel></rss>