<?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[Extracting multiple lines at once from multiple files]]></title><description><![CDATA[<p dir="auto">Hi,</p>
<p dir="auto">I have a lot of files that I need to pull the below code from and extract to a text document.  I already have wrote the regex code to find the stuff I need (in parentheses).  For a single file, this is ok because I just bookmark the line and then remove the unbookmarked lines.  But is there a way to do this for multiple files in a folder at a time?  Below is an example of a file I’m working with.</p>
<pre><code>/NDTMRY+Helvetica-Narrow+T42+SQWZGL*1 
2.97497 5.423 5.03197 0 
]xsh
164 45.1998 mo
(YES)
[4.65033 4.65031 0 ]xsh
17 46.4994 mo
</code></pre>
<p dir="auto">And this is my regex code to find what I need:</p>
<p dir="auto"><code>^\(.*?$</code></p>
<p dir="auto">This bookmarks the (yes) and then I just use the search&gt; bookmark&gt; remove unbookmarked lines.  But this only works for one file at a time.</p>
<p dir="auto">Thanks !</p>
]]></description><link>https://community.notepad-plus-plus.org/topic/21809/extracting-multiple-lines-at-once-from-multiple-files</link><generator>RSS for Node</generator><lastBuildDate>Sat, 11 Apr 2026 14:28:38 GMT</lastBuildDate><atom:link href="https://community.notepad-plus-plus.org/topic/21809.rss" rel="self" type="application/rss+xml"/><pubDate>Fri, 10 Sep 2021 15:01:04 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Extracting multiple lines at once from multiple files on Sun, 12 Sep 2021 17:28:31 GMT]]></title><description><![CDATA[<p dir="auto">Hello <a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/21452">@acme1235</a>, <a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/12335">@terry-r</a>, <a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/7377">@alan-kilborn</a> and <strong>All</strong>,</p>
<p dir="auto">My bad ! I just paste the <strong>literal</strong> <a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/12335">@terry-r</a>’s text to test my <strong>regexes</strong>. So, I could’nt get the Search Results <strong>context</strong> options. Of course, <strong>Alan</strong>, your N++ solution is just the more simple and the <strong>best</strong> one ;-))</p>
<p dir="auto">Anyway, I suppose that <a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/21452">@acme1235</a> should be pleased with the <strong>many</strong> ways to display results !</p>
<p dir="auto">BR</p>
<p dir="auto">guy038</p>
]]></description><link>https://community.notepad-plus-plus.org/post/69667</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/69667</guid><dc:creator><![CDATA[guy038]]></dc:creator><pubDate>Sun, 12 Sep 2021 17:28:31 GMT</pubDate></item><item><title><![CDATA[Reply to Extracting multiple lines at once from multiple files on Sun, 12 Sep 2021 13:18:26 GMT]]></title><description><![CDATA[<p dir="auto">I’ll point this out here, because maybe a lot of people don’t know it.  And it seems to pull the same data <a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/12335">@Terry-R</a> obtained, bit making some of the steps he described unnecessary.</p>
<p dir="auto">Start with the <em>Search results</em> window as Terry showed it:</p>
<p dir="auto"><img src="/assets/uploads/files/1631452155145-781b6239-8625-4a2b-b95d-657f9ee45b42-image.png" alt="781b6239-8625-4a2b-b95d-657f9ee45b42-image.png" class=" img-fluid img-markdown" /></p>
<p dir="auto">Right click anywhere in the “Search” line, for example where I show the yellow dot here:</p>
<p dir="auto"><img src="/assets/uploads/files/1631452230169-f483f034-7767-4625-8324-2507beacb396-image.png" alt="f483f034-7767-4625-8324-2507beacb396-image.png" class=" img-fluid img-markdown" /></p>
<p dir="auto">The context menu will appear where you’ll want to choose “Copy Selected Line(s)”:</p>
<p dir="auto"><img src="/assets/uploads/files/1631452291706-1bcd41af-bef7-48e8-9817-a7fe0f2d198d-image.png" alt="1bcd41af-bef7-48e8-9817-a7fe0f2d198d-image.png" class=" img-fluid img-markdown" /></p>
<p dir="auto">Side note: It really is a poor name, because nothing was selected before running the command. :(</p>
<p dir="auto">After running that command, you’ll have the following in the clipboard:</p>
<pre><code>(YES)
(PICK)
(NZ)
</code></pre>
<p dir="auto">In a nutshell what the “Copy Selected Line(s)” command does is copy only the data-lines of the search result – no search info, no filename info, no “Line xx:” prefix.</p>
<p dir="auto">Where the "selected part comes in is if you <em>do</em> make a selection before running the command via right-clicking somewhere on the selection, for example:</p>
<p dir="auto"><img src="/assets/uploads/files/1631452529485-a018e992-1c9a-478b-b421-d28a0a4c6c26-image.png" alt="a018e992-1c9a-478b-b421-d28a0a4c6c26-image.png" class=" img-fluid img-markdown" /></p>
<p dir="auto">Then your result (in the clipboard) would be just from those lines selected:</p>
<pre><code>(YES)
(PICK)
</code></pre>
]]></description><link>https://community.notepad-plus-plus.org/post/69658</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/69658</guid><dc:creator><![CDATA[Alan Kilborn]]></dc:creator><pubDate>Sun, 12 Sep 2021 13:18:26 GMT</pubDate></item><item><title><![CDATA[Reply to Extracting multiple lines at once from multiple files on Sun, 12 Sep 2021 09:25:45 GMT]]></title><description><![CDATA[<p dir="auto">Hi, <a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/21452">@acme1235</a>, <a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/12335">@terry-r</a> and <strong>All</strong>,</p>
<p dir="auto">Ah…, yes, <strong>clever</strong> method, <strong>Terry</strong> ;-)</p>
<p dir="auto">And from <strong>your</strong> search results panel, here are <strong>two</strong> other possible <strong>layouts</strong> :</p>
<ul>
<li>
<p dir="auto">With the regex S/R :</p>
<ul>
<li>
<p dir="auto">SEARCH <strong><code>(?-s)\(1\x20hit\)\R</code></strong></p>
</li>
<li>
<p dir="auto">REPLACE <strong><code>Leave EMPTY</code></strong></p>
</li>
</ul>
</li>
</ul>
<p dir="auto">we would obtain :</p>
<pre><code class="language-diff">Search "^\(.*?$" (3 hits in 3 files of 4 searched)
  C:\Users\terry\Documents\NPP tests\21809\n1.txt 	Line 5: (YES)
  C:\Users\terry\Documents\NPP tests\21809\n2.txt 	Line 5: (PICK)
  C:\Users\terry\Documents\NPP tests\21809\n3.txt 	Line 5: (NZ)
</code></pre>
<ul>
<li>
<p dir="auto">with the regex S/R :</p>
<ul>
<li>
<p dir="auto">SEARCH <strong><code>(?-s)^Search.+\R|\x20\(1\x20hit\)\R</code></strong></p>
</li>
<li>
<p dir="auto">REPLACE <strong><code>Leave EMPTY</code></strong></p>
</li>
</ul>
</li>
</ul>
<p dir="auto">we would obtain :</p>
<pre><code class="language-diff">  C:\Users\terry\Documents\NPP tests\21809\n1.txt	Line 5: (YES)
  C:\Users\terry\Documents\NPP tests\21809\n2.txt	Line 5: (PICK)
  C:\Users\terry\Documents\NPP tests\21809\n3.txt	Line 5: (NZ)
</code></pre>
<p dir="auto">Best Regards,</p>
<p dir="auto">guy038</p>
]]></description><link>https://community.notepad-plus-plus.org/post/69656</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/69656</guid><dc:creator><![CDATA[guy038]]></dc:creator><pubDate>Sun, 12 Sep 2021 09:25:45 GMT</pubDate></item><item><title><![CDATA[Reply to Extracting multiple lines at once from multiple files on Sun, 12 Sep 2021 02:40:32 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/21452">@Acme1235</a> said in <a href="/post/69607">Extracting multiple lines at once from multiple files</a>:</p>
<blockquote>
<p dir="auto">I have a lot of files that I need to pull the below code from and extract to a text document.</p>
</blockquote>
<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/21452">@Acme1235</a>  <a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/195">@guy038</a> I’ve done some testing and it works as I expected.</p>
<p dir="auto">I created 4 files, 3 of which had the <code>(xxx)</code> code in them with differing text inside each parentheses. I ran the “Find in Files” option with the OP’s regex and the search result window provided the following:</p>
<pre><code>Search "^\(.*?$" (3 hits in 3 files of 4 searched)
  C:\Users\terry\Documents\NPP tests\21809\n1.txt (1 hit)
	Line 5: (YES)
  C:\Users\terry\Documents\NPP tests\21809\n2.txt (1 hit)
	Line 5: (PICK)
  C:\Users\terry\Documents\NPP tests\21809\n3.txt (1 hit)
	Line 5: (NZ)
</code></pre>
<p dir="auto">This is then selected and copied to another (empty) tab and the following regex is run to remove the unwanted data. It’s still a bit rough, I hadn’t tried to remove EOLs as well, it’s just a test and the process could be streamlined, possibly incorporating into a macro, so a <code>one-click</code> process.<br />
Find What:<code>(?-is)^.*?Line \d+:\h*(.+)|.*</code><br />
Replace With:<code>\1</code></p>
<p dir="auto">and I get</p>
<pre><code>

(YES)

(PICK)

(NZ)
</code></pre>
<p dir="auto">At this point there are still empty lines which can easily be removed using the Edit, Line Operations, Remove Empty Lines. The result is a single tab containing the data required which can then be saved as a single file.`</p>
<p dir="auto">Terry</p>
]]></description><link>https://community.notepad-plus-plus.org/post/69651</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/69651</guid><dc:creator><![CDATA[Terry R]]></dc:creator><pubDate>Sun, 12 Sep 2021 02:40:32 GMT</pubDate></item><item><title><![CDATA[Reply to Extracting multiple lines at once from multiple files on Sat, 11 Sep 2021 22:25:47 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/195">@guy038</a> said in <a href="/post/69609">Extracting multiple lines at once from multiple files</a>:</p>
<blockquote>
<p dir="auto">Here is the solution : just find the appropriate regex S/R in order to delete any line which does not begin with an opening parenthese ( and use the Find in Files  panel ( Ctrl + Shift + F ) !</p>
</blockquote>
<p dir="auto">I think there is another, possibly better or at least non-destructive method. It uses the find in files, but not to remove lines. I refer to the <a href="https://npp-user-manual.org/docs/searching/#search-results-window" rel="nofollow ugc">search results window</a>. This will:<br />
<em><strong>From Find All in … searches, three types of sections are added to the Search results window. First is a line describing what was searched for, how many total matches (known as “hits”) occurred (this is also shown in the title bar for the window, for the most recently-occurring search), and how many files had matches. Second is a line that shows the filename with the matches and the count of matches for that file (this type will be repeated if the search found multiple files with matches). Last comes the details about the matches found, including line number and the line contents with the matched text emphasized. The default emphasis is red text on a yellow background, but this may be changed in the Style Configurator’s “Search result” Language area.</strong></em><br />
Key points are that it provides the filename, number of hits in that file and the line containing that hit. Of course this information can then be copied and further edited. As the OP wants that information in one file I think this process would expedite that and the side benefit is the original files remain unedited.</p>
<p dir="auto">I’m not on a PC at this time to further the test but feel confident it is easily achievable.</p>
<p dir="auto">Terry</p>
]]></description><link>https://community.notepad-plus-plus.org/post/69648</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/69648</guid><dc:creator><![CDATA[Terry R]]></dc:creator><pubDate>Sat, 11 Sep 2021 22:25:47 GMT</pubDate></item><item><title><![CDATA[Reply to Extracting multiple lines at once from multiple files on Sat, 11 Sep 2021 20:04:04 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/195">@guy038</a> thank you for your help!  I was looking at the problem backwards</p>
]]></description><link>https://community.notepad-plus-plus.org/post/69647</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/69647</guid><dc:creator><![CDATA[Acme1235]]></dc:creator><pubDate>Sat, 11 Sep 2021 20:04:04 GMT</pubDate></item><item><title><![CDATA[Reply to Extracting multiple lines at once from multiple files on Fri, 10 Sep 2021 17:24:26 GMT]]></title><description><![CDATA[<p dir="auto">Hello, <a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/21452">@acme1235</a> and <strong>All</strong>,</p>
<p dir="auto">Here is the solution : just find the <strong>appropriate</strong> regex S/R in order to <strong>delete</strong> any line which does <strong>not</strong> begin with an <strong>opening</strong> parenthese <strong><code>(</code></strong> and use the <strong><code>Find in Files </code></strong> panel ( <strong><code>Ctrl + Shift + F</code></strong> ) !</p>
<hr />
<p dir="auto">So, the road map is :</p>
<ul>
<li>
<p dir="auto">Open the <strong>Find in Files</strong> dialog  ( <strong><code>Ctrl + Shift + F</code></strong> )</p>
</li>
<li>
<p dir="auto">SEARCH <strong><code>(?-s)^[^(].*\R?</code></strong></p>
</li>
<li>
<p dir="auto">REPLACE <strong><code>Leave EMPTY</code></strong></p>
</li>
<li>
<p dir="auto">Type in the <strong>subset</strong> of files to process ( <strong><code>*.txt</code></strong>, <strong><code>*.log</code></strong> or else… ), in the <strong><code>Filters</code></strong> zone</p>
</li>
<li>
<p dir="auto">Type in the <strong>complete</strong> path of the <strong>needed</strong> directory, in the <strong><code>Directory</code></strong> zone or select it with the <strong><code>...</code></strong> button</p>
</li>
<li>
<p dir="auto"><strong>Untick</strong> all the <strong><code>box</code></strong> options</p>
</li>
<li>
<p dir="auto">Click on the <strong><code>Replace All</code></strong> button</p>
</li>
<li>
<p dir="auto"><strong>Valid</strong> the <strong><code>Are you sure?</code></strong> dialog</p>
</li>
</ul>
<p dir="auto">Voila !</p>
<hr />
<p dir="auto">Of course, for more <strong>security</strong>, I advice you to test, <strong>first</strong>, my <strong>regex</strong> S/R, against <strong>one</strong> file by, either :</p>
<ul>
<li>
<p dir="auto">Use the <strong>Replace</strong> dialog ( <strong><code>Ctrl + H</code></strong> ) and tick the <strong><code>Wrap around</code></strong> option to <strong>only</strong> process the <strong>current</strong> file</p>
</li>
<li>
<p dir="auto">Type in a <strong>complete</strong> file name in the <strong><code>Filters</code></strong> field of the <strong><code>Find in Files</code></strong> dialog</p>
</li>
</ul>
<p dir="auto">Of course, you may make a <strong>complete backup</strong> of the directory to <strong>process</strong>, too !</p>
<p dir="auto">Best Regards</p>
<p dir="auto">guy038</p>
]]></description><link>https://community.notepad-plus-plus.org/post/69609</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/69609</guid><dc:creator><![CDATA[guy038]]></dc:creator><pubDate>Fri, 10 Sep 2021 17:24:26 GMT</pubDate></item></channel></rss>