<?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[move lines containing specific words to a specific position]]></title><description><![CDATA[<p dir="auto">Hi to all. This question is similar to one I asked a while back, but with a few small differences.<br />
On several text files I need to move lines that contain specific words, to a certain position.<br />
In practice the lines that contain<br />
REM GENRE<br />
REM DATE<br />
must go respectively to line 1 and line 2 of the text.<br />
After REM GENRE and REM DATE there is some text that is variable from file to file.<br />
Example:</p>
<p dir="auto">REM COMMENT “CUETools generated CUE sheet”<br />
PERFORMER “Black Wings”<br />
TITLE “Whispers Of Time”<br />
REM DATE 2024<br />
REM DISCNUMBER 1<br />
REM TOTALDISCS 1<br />
REM GENRE “Metal”<br />
FILE “Black Wings - Whispers Of Time.flac” WAVE<br />
TRACK 01 AUDIO<br />
PERFORMER “Black Wings”<br />
TITLE “Opening the Gates”<br />
INDEX 01 00:00:00<br />
TRACK 02 AUDIO<br />
PERFORMER “Black Wings”</p>
<p dir="auto">it must become</p>
<p dir="auto">REM GENRE “Metal”<br />
REM DATE 2024<br />
REM COMMENT “CUETools generated dummy CUE sheet”<br />
PERFORMER “Black Wings”<br />
TITLE “Whispers Of Time”<br />
REM DISCNUMBER 1<br />
REM TOTALDISCS 1<br />
FILE “Black Wings - Whispers Of Time.flac” WAVE<br />
TRACK 01 AUDIO<br />
PERFORMER “Black Wings”<br />
TITLE “Opening the Gates”<br />
INDEX 01 00:00:00<br />
TRACK 02 AUDIO<br />
PERFORMER “Black Wings”</p>
<p dir="auto">Is there a way with some regex?<br />
Thanks in advance</p>
]]></description><link>https://community.notepad-plus-plus.org/topic/26634/move-lines-containing-specific-words-to-a-specific-position</link><generator>RSS for Node</generator><lastBuildDate>Sat, 16 May 2026 07:29:44 GMT</lastBuildDate><atom:link href="https://community.notepad-plus-plus.org/topic/26634.rss" rel="self" type="application/rss+xml"/><pubDate>Mon, 17 Feb 2025 09:44:35 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to move lines containing specific words to a specific position on Mon, 17 Feb 2025 13:30:28 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></p>
<p dir="auto">thanx again. I solved with a macro! Thanks again for the idea and initial regex!</p>
]]></description><link>https://community.notepad-plus-plus.org/post/99892</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/99892</guid><dc:creator><![CDATA[Rockberto Manenti]]></dc:creator><pubDate>Mon, 17 Feb 2025 13:30:28 GMT</pubDate></item><item><title><![CDATA[Reply to move lines containing specific words to a specific position on Mon, 17 Feb 2025 12:11:53 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/rockberto-manenti" aria-label="Profile: Rockberto-Manenti">@<bdi>Rockberto-Manenti</bdi></a> said in <a href="/post/99890">move lines containing specific words to a specific position</a>:</p>
<blockquote>
<p dir="auto">but I have to apply it first on REM DATE and then on REM GENRE because otherwise if I do GENRE first and then DATE, the latter puts it as the first line.</p>
</blockquote>
<p dir="auto">Yea, ok, that’s a small detail, so I didn’t pay much real attention to the actual one you wanted first.  You got the idea.  :-)</p>
<blockquote>
<p dir="auto">faster</p>
</blockquote>
<p dir="auto">Sure, could do a single regex, but it doesn’t excite me to formulate that for you.  Someone else will, I’m sure.  :-)</p>
]]></description><link>https://community.notepad-plus-plus.org/post/99891</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/99891</guid><dc:creator><![CDATA[Alan Kilborn]]></dc:creator><pubDate>Mon, 17 Feb 2025 12:11:53 GMT</pubDate></item><item><title><![CDATA[Reply to move lines containing specific words to a specific position on Mon, 17 Feb 2025 12:08:59 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><br />
many thanks.<br />
this regex works, but I have to apply it first on REM DATE and then on REM GENRE because otherwise if I do GENRE first and then DATE, the latter puts it as the first line.</p>
<p dir="auto">if it were possible to do it in a single operation it would be faster.<br />
The two lines REM GENRE and REM DATE are not always in the same order but random<br />
Many thanks!</p>
]]></description><link>https://community.notepad-plus-plus.org/post/99890</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/99890</guid><dc:creator><![CDATA[Rockberto Manenti]]></dc:creator><pubDate>Mon, 17 Feb 2025 12:08:59 GMT</pubDate></item><item><title><![CDATA[Reply to move lines containing specific words to a specific position on Mon, 17 Feb 2025 11:48:44 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/rockberto-manenti" aria-label="Profile: Rockberto-Manenti">@<bdi>Rockberto-Manenti</bdi></a></p>
<p dir="auto">Do it in 2 operations.</p>
<p dir="auto">First, do:</p>
<ul>
<li>Find: <code>\A(?s-i)(.*?)^(REM GENRE (?-s).+?\R)</code></li>
<li>Replace: <code>${2}${1}</code></li>
</ul>
<p dir="auto">Then, repeat the first replacement, replacing <code>GENRE</code> with <code>DATE</code>.</p>
<p dir="auto">If <code>DATE</code> always appears before <code>GENRE</code> in your files, it is possible (reasonable) to do it in one operation.  It is also possible to do it in one operation if the ordering is random.</p>
<p dir="auto">But, as you were just asking for a solution with no more specifics, two operations suffice.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/99889</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/99889</guid><dc:creator><![CDATA[Alan Kilborn]]></dc:creator><pubDate>Mon, 17 Feb 2025 11:48:44 GMT</pubDate></item></channel></rss>