<?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[Remove last 5 characters from lines in text file?]]></title><description><![CDATA[<p dir="auto">Hi everyone,</p>
<p dir="auto">I would like to get Notepad++ to remove the last 5 lines from a text file I have. I want to turn this</p>
<p dir="auto">10 Cloverfield Lane 2016<br />
12 Angry Men 1957</p>
<p dir="auto">into this</p>
<p dir="auto">10 Cloverfield Lane<br />
12 Angry Men</p>
<p dir="auto">I have Googled but I’m stuck. Thanks for any help.</p>
]]></description><link>https://community.notepad-plus-plus.org/topic/24597/remove-last-5-characters-from-lines-in-text-file</link><generator>RSS for Node</generator><lastBuildDate>Sun, 17 May 2026 08:10:33 GMT</lastBuildDate><atom:link href="https://community.notepad-plus-plus.org/topic/24597.rss" rel="self" type="application/rss+xml"/><pubDate>Mon, 19 Jun 2023 12:44:04 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Remove last 5 characters from lines in text file? on Mon, 19 Jun 2023 14:49:25 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/drghty" aria-label="Profile: drghty">@<bdi>drghty</bdi></a></p>
<p dir="auto">By the way, you wrote “remove the last 5 lines from a text file”, but your example indicates removal of the last 5 characters from each line, so I assume the latter was correct.</p>
<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/mark-olson" aria-label="Profile: Mark-Olson">@<bdi>Mark-Olson</bdi></a></p>
<p dir="auto">Ah, yes — my bad, and thanks much for the correction.</p>
<p dir="auto">For <a class="plugin-mentions-user plugin-mentions-a" href="/user/drghty" aria-label="Profile: drghty">@<bdi>drghty</bdi></a> , just to make sure you understand why Mark’s correction is potentially important, depending on the total content of your text file, my FIND pattern <code>.{5}$</code> would also match up to five consecutive newline sequences, if your file has multiple consecutive newlines, if it does not include <code>(?-s)</code>, or you don’t have <code>. matches newline</code> disabled.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/87214</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/87214</guid><dc:creator><![CDATA[M Andre Z Eckenrode]]></dc:creator><pubDate>Mon, 19 Jun 2023 14:49:25 GMT</pubDate></item><item><title><![CDATA[Reply to Remove last 5 characters from lines in text file? on Mon, 19 Jun 2023 14:30:22 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/m-andre-z-eckenrode" aria-label="Profile: M-Andre-Z-Eckenrode">@<bdi>M-Andre-Z-Eckenrode</bdi></a><br />
Slightly off, because you need to make sure that <code>.</code> doesn’t match newline.<br />
Correct find/replace is<br />
FIND: <code>(?-s).{5}$</code> (<code>(?-s)</code> turns OFF <code>. matches newline</code>)<br />
REPLACE: [empty]</p>
]]></description><link>https://community.notepad-plus-plus.org/post/87210</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/87210</guid><dc:creator><![CDATA[Mark Olson]]></dc:creator><pubDate>Mon, 19 Jun 2023 14:30:22 GMT</pubDate></item><item><title><![CDATA[Reply to Remove last 5 characters from lines in text file? on Mon, 19 Jun 2023 14:27:37 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/drghty" aria-label="Profile: drghty">@<bdi>drghty</bdi></a> said in <a href="/post/87208">Remove last 5 characters from lines in text file?</a>:</p>
<blockquote>
<p dir="auto">Hi everyone,<br />
I would like to get Notepad++ to remove the last 5 lines from a text file I have.</p>
</blockquote>
<p dir="auto">Make sure caret is at start of file, or at or before first line you want to be affected, or enable <code>Wrap around</code><br />
Search Mode = <code>Regular expression</code></p>
<p dir="auto">FIND: <code>.{5}$</code><br />
REPLACE: [empty]</p>
<p dir="auto"><code>.{5}</code> matches any five characters<br />
<code>$</code> matches the end of the line</p>
]]></description><link>https://community.notepad-plus-plus.org/post/87209</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/87209</guid><dc:creator><![CDATA[M Andre Z Eckenrode]]></dc:creator><pubDate>Mon, 19 Jun 2023 14:27:37 GMT</pubDate></item></channel></rss>