<?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[How do you get a macro recording to delete a certain number of lines?]]></title><description><![CDATA[<p dir="auto">Before I import data from a csv file into Excel, I first edit it with Notepad++. So far it’s working very well! Now I wanted to record a new macro that always deletes a certain number of lines in the middle of the text in every csv file. Unfortunately, the newly recorded macro works the same as the previous one. The new task that is supposed to delete a certain number of lines is ignored. Does anyone have a tip on how I can get this into the macro recording? If that’s not possible, I would ask you to program this function in the next possible update. Thanks in advance!<br />
I’m using for this the newest version of Notepad++ v8.6 (64-bit) installed on usb stick as portable mode.</p>
]]></description><link>https://community.notepad-plus-plus.org/topic/25274/how-do-you-get-a-macro-recording-to-delete-a-certain-number-of-lines</link><generator>RSS for Node</generator><lastBuildDate>Mon, 09 Nov 2026 18:18:42 GMT</lastBuildDate><atom:link href="https://community.notepad-plus-plus.org/topic/25274.rss" rel="self" type="application/rss+xml"/><pubDate>Sat, 23 Dec 2023 11:47:22 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to How do you get a macro recording to delete a certain number of lines? on Sun, 24 Dec 2023 16:25:10 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/tibor-s%C3%BCtsch" aria-label="Profile: Tibor-Sütsch">@<bdi>Tibor-Sütsch</bdi></a>, another way to do it that is similar to the first version I posted is:<br />
<strong>Search: <code>(.*xyzzy.*\R)(?:.*\R)*?(.*plugh.*)</code><br />
Replace: <code>nothing or empty</code></strong></p>
<p dir="auto">That will delete all lines starting with one that contains the string <code>xyzzy</code> and ending with one  that contains <code>plugh</code>. I put the <code>(.*xyzzy.*\R)</code> and <code>(.*plugh.*)</code> parts in parentheses so that you have the option of using either <code>\1</code> and or <code>\2</code> in the replacement part if you need to keep either of those.  For example, to delete everything after <code>xyzzy</code> and up to and including <code>plugh</code> the replacement part would be <code>\1</code>.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/91406</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/91406</guid><dc:creator><![CDATA[mkupper]]></dc:creator><pubDate>Sun, 24 Dec 2023 16:25:10 GMT</pubDate></item><item><title><![CDATA[Reply to How do you get a macro recording to delete a certain number of lines? on Sat, 23 Dec 2023 20:34:24 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 />
Hello Alan,</p>
<p dir="auto">I don’t understand the individual commands (not yet). ;) But I entered the values for my lines and it works exactly as I imagine! Perfect!<br />
Thank you very much!<br />
Wish you all a Merry Christmas!</p>
]]></description><link>https://community.notepad-plus-plus.org/post/91396</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/91396</guid><dc:creator><![CDATA[Tibor Sütsch]]></dc:creator><pubDate>Sat, 23 Dec 2023 20:34:24 GMT</pubDate></item><item><title><![CDATA[Reply to How do you get a macro recording to delete a certain number of lines? on Sat, 23 Dec 2023 20:24:50 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/tibor-s%C3%BCtsch" aria-label="Profile: Tibor-Sütsch">@<bdi>Tibor-Sütsch</bdi></a></p>
<p dir="auto">You can delete lines <code>M</code> through <code>N</code> (inclusive) in a file by doing this:</p>
<ul>
<li>calculate <code>X</code> = <code>M</code> - 1</li>
<li>calculate <code>Y</code> = <code>N</code> - <code>X</code></li>
<li>ReplaceAll <code>\A(?:.*\R){X}\K(?:.*\R){Y}</code> with nothing (checkmarking <em>Regular expression</em> and <em>Wrap around</em>) – after plugging in the calculated numbers for <code>X</code> and <code>Y</code>)</li>
</ul>
]]></description><link>https://community.notepad-plus-plus.org/post/91392</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/91392</guid><dc:creator><![CDATA[Alan Kilborn]]></dc:creator><pubDate>Sat, 23 Dec 2023 20:24:50 GMT</pubDate></item><item><title><![CDATA[Reply to How do you get a macro recording to delete a certain number of lines? on Sat, 23 Dec 2023 18:47:53 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/tibor-s%C3%BCtsch" aria-label="Profile: Tibor-Sütsch">@<bdi>Tibor-Sütsch</bdi></a><br />
Just thinking slightly out of the box here.</p>
<p dir="auto">I’m not on a PC currently to test, but if all the lines were numbered 1 onwards a regular expression would then bookmark the relevant numbered lines. Those would then be deleted and then the remaining lines would have those lines numbers removed.</p>
<p dir="auto">I think that is all achievable using a macro.</p>
<p dir="auto">I’ll test a bit later and hopefully come back with a solution.</p>
<p dir="auto">Terry</p>
]]></description><link>https://community.notepad-plus-plus.org/post/91391</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/91391</guid><dc:creator><![CDATA[Terry R]]></dc:creator><pubDate>Sat, 23 Dec 2023 18:47:53 GMT</pubDate></item><item><title><![CDATA[Reply to How do you get a macro recording to delete a certain number of lines? on Sat, 23 Dec 2023 18:33:19 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/mkupper" aria-label="Profile: mkupper">@<bdi>mkupper</bdi></a><br />
hello mkupper,<br />
thank you for the fast reaction.<br />
I already use search and replace in the macro I recorded so far. Which also works very well.<br />
In addition, now I wanted to automatically delete everything from the 2nd to the 235th line. This leaves me with the remaining 67 lines of 301. But the problem is that there are no identical or identifiable groups of characters in these lines that need to be deleted. So it remains me only the orientation 2nd to the 235th lines. And as far as I understand it, unfortunately this no longer works with search and replace.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/91390</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/91390</guid><dc:creator><![CDATA[Tibor Sütsch]]></dc:creator><pubDate>Sat, 23 Dec 2023 18:33:19 GMT</pubDate></item><item><title><![CDATA[Reply to How do you get a macro recording to delete a certain number of lines? on Sat, 23 Dec 2023 16:25:44 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/tibor-s%C3%BCtsch" aria-label="Profile: Tibor-Sütsch">@<bdi>Tibor-Sütsch</bdi></a> If you are using Notepad++'s find or search function to get to the spot in the middle of the CSV file then you can do a search/replace with the replacement part being nothing (empty) to delete those lines.</p>
<p dir="auto">For example, let’s say you want to delete a line that contains the phrase “xyzzy” and the following two lines meaning you will be deleting three lines.</p>
<p dir="auto"><strong>Search:</strong> <code>.*xyzzy.*\R.*\R.*\R</code><br />
<strong>Replace:</strong> <code>(nothing or empty)</code></p>
<p dir="auto">The macro can do <code>Ctrl-H</code> .*xyzzy.*\R.*\R.*\R <code>tab</code> <code>delete</code> <code>Alt+A</code> <code>Esc</code></p>
<p dir="auto">If you regularly switch your search/find mode between regular expressions or and normal/extended then you should include <code>Alt-G</code> to activate regular expression mode.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/91387</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/91387</guid><dc:creator><![CDATA[mkupper]]></dc:creator><pubDate>Sat, 23 Dec 2023 16:25:44 GMT</pubDate></item></channel></rss>