<?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 to remove the content from file1 or list1 (e.g. 4000 usernames) from file2 or list2 (e.g. 50000 usernames)]]></title><description><![CDATA[<p dir="auto">Hello,</p>
<p dir="auto">how can the content from file1 or list1 (e.g. 4000 usernames) from file2 or list2 (e.g. 50000 usernames).</p>
<p dir="auto">file1 or list1 looks like:<br />
user3<br />
user9<br />
user10<br />
user2<br />
user30</p>
<p dir="auto">file2 or list2 looks like:<br />
[role]<br />
rid=2000<br />
rdesc=Members<br />
user=user100;user70;user4030;user10;user300;user33;user9;user2;user35;user290;user30;user158;user3;user893;user10;</p>
<p dir="auto">firstly i tried to modify file1 with<br />
Find what: \r\n<br />
Replace with: -<br />
Search Mode: Regular expression</p>
<p dir="auto">Then file1 looks like:<br />
user3-user9-user10-user2-user30</p>
<p dir="auto">Then change it with:<br />
Find what: -<br />
Replace with ;)|(<br />
Search mode: Normal</p>
<p dir="auto">Then file1 looks like:<br />
user3;)|(user9;)|(user10;)|(user2;)|(user30</p>
<p dir="auto">Then i add at the start a “(” and at the end a “;)”</p>
<p dir="auto">Then file1 looks like:<br />
(user3;)|(user9;)|(user10;)|(user2;)|(user30;)</p>
<p dir="auto">I open file2 in notepad++ and copy’n’paste the file1 content to the “Find what:” field.<br />
Find what: (user3;)|(user9;)|(user10;)|(user2;)|(user30)<br />
Replace with: &lt;empty&gt;<br />
Search mode: Normal</p>
<p dir="auto">The file2 looks like<br />
[role]<br />
rid=2000<br />
rdesc=Members<br />
user=user100;user70;user4030;user300;user33;user35;user290;user158;user893;user10;</p>
<p dir="auto">Is there another possibilty to solve this?</p>
<p dir="auto">Best regards<br />
Armin</p>
]]></description><link>https://community.notepad-plus-plus.org/topic/16130/how-to-remove-the-content-from-file1-or-list1-e-g-4000-usernames-from-file2-or-list2-e-g-50000-usernames</link><generator>RSS for Node</generator><lastBuildDate>Sun, 07 Jun 2026 08:31:21 GMT</lastBuildDate><atom:link href="https://community.notepad-plus-plus.org/topic/16130.rss" rel="self" type="application/rss+xml"/><pubDate>Sat, 04 Aug 2018 14:19:41 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to How to remove the content from file1 or list1 (e.g. 4000 usernames) from file2 or list2 (e.g. 50000 usernames) on Tue, 07 Aug 2018 10:14:42 GMT]]></title><description><![CDATA[<p dir="auto">This question comes up rather frequently, and it is always tackled with a regular-expression solution.  This is <em>okay</em>… but sometimes people have trouble with that, so how about this time we throw down a Pythonscript solution?  [Thanks, Alan, for the hint…]</p>
<p dir="auto">A variant of this question is “How do I replace a list of words (and corresponding replacement values) in one document and have the replace act upon another document?”.  The question in this thread is just a special case of that:  Deleting is simply where a replacement value is zero length.</p>
<p dir="auto">So I propose that the word list should have the following form, and be present in the clipboard when the script is run, with the data file to be operated on in the active Notepad++ editor tab:</p>
<p dir="auto"><code>DELIMITERsearhtextDELIMITERreplacementtext</code><br />
where <code>replacementtext</code> can be empty in order to do a deletion</p>
<p dir="auto">Here’s an example:</p>
<p dir="auto">Text to be copied to clipboard prior to running the script:</p>
<pre><code class="language-z">:silver:golden
@silently@sqwalkingly
.sqwalkingly .
</code></pre>
<p dir="auto">I purposefully used a different delimiter character on each line to show that that is possible…hmmm, maybe this just confuses things?  Oh, well…</p>
<p dir="auto">Text to be operated on, all by itself in a fresh editor tab:</p>
<p dir="auto"><code>Six silver swans swam silently seaward</code></p>
<p dir="auto">After running the script with that editor tab active, its text should be changed to:</p>
<p dir="auto"><code>Six golden swans swam seaward</code></p>
<p dir="auto">Note that in the second line of the list, <code>silently</code> is changed to <code>sqwalkingly</code>.  But…in the third line, <code>sqwalkingly</code> followed by a space is deleted (no text follows the final delimiter, meaning change the search text to nothing, i.e., delete it).</p>
<p dir="auto">Hopefully the reader can follow the progression of replacements in this case.</p>
<p dir="auto">So…to perform the OP’s original deletion of data, one would create the word list as follows and copy it to the clipboard:</p>
<pre><code class="language-z">!user3;!
!user9;!
!user10;!
!user2;!
!user30;!
</code></pre>
<p dir="auto">Remember, the format is:  <code>DELIMITERsearhtextDELIMITERreplacementtext</code> where <code>replacementtext</code> can be empty in order to do a deletion (as we are doing here).  This time I have arbitrarily used the <code>!</code> character as the delimiter, and I was consistent about it in each line, as one usually would be.</p>
<p dir="auto">Then, running the script in the file of the original data:</p>
<pre><code class="language-z">[role]
rid=2000
rdesc=Members
user=user100;user70;user4030;user10;user300;user33;user9;user2;user35;user290;user30;user158;user3;user893;user10;
</code></pre>
<p dir="auto">One obtains, with the desired users eliminated:</p>
<pre><code class="language-z">[role]
rid=2000
rdesc=Members
user=user100;user70;user4030;user300;user33;user35;user290;user158;user893;
</code></pre>
<p dir="auto">Here’s the script code for <strong>R</strong>eplace<strong>U</strong>sing<strong>L</strong>ist<strong>I</strong>n<strong>C</strong><a href="http://lipboard.py" rel="nofollow ugc">lipboard.py</a>:</p>
<pre><code class="language-z">def RULIC__main():
    if not editor.canPaste(): return
    cp = editor.getCurrentPos()
    editor.setSelection(cp, cp)  # cancel any active selection(s)
    doc_orig_len = editor.getTextLength()
    editor.paste()  # paste so we can get easy access to the clipboard text
    cp = editor.getCurrentPos()  # this has moved because of the paste
    clipboard_lines_list = editor.getTextRange(cp - editor.getTextLength() + doc_orig_len, cp).splitlines()
    editor.undo()  # revert the paste action, but sadly, this puts it in the undo buffer...so it can be redone
    editor.beginUndoAction()
    for line in clipboard_lines_list:
        try: (search_text, replace_text) = line.rstrip('\n\r')[1:].split(line[0])
        except (ValueError, IndexError): continue
        editor.replace(search_text, replace_text)
    editor.endUndoAction()

RULIC__main()
</code></pre>
]]></description><link>https://community.notepad-plus-plus.org/post/33977</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/33977</guid><dc:creator><![CDATA[Scott Sumner]]></dc:creator><pubDate>Tue, 07 Aug 2018 10:14:42 GMT</pubDate></item><item><title><![CDATA[Reply to How to remove the content from file1 or list1 (e.g. 4000 usernames) from file2 or list2 (e.g. 50000 usernames) on Sun, 05 Aug 2018 18:10:35 GMT]]></title><description><![CDATA[<p dir="auto">This seems a common request.  Maybe it is time to script it?</p>
]]></description><link>https://community.notepad-plus-plus.org/post/33962</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/33962</guid><dc:creator><![CDATA[Alan Kilborn]]></dc:creator><pubDate>Sun, 05 Aug 2018 18:10:35 GMT</pubDate></item><item><title><![CDATA[Reply to How to remove the content from file1 or list1 (e.g. 4000 usernames) from file2 or list2 (e.g. 50000 usernames) on Sat, 04 Aug 2018 20:18:52 GMT]]></title><description><![CDATA[<p dir="auto">Hello, @armir-irger and <strong>All</strong>,</p>
<p dir="auto">Indeed, there is an <strong>other</strong> way to manage this task, using just <strong>one</strong> regex S/R :-))</p>
<p dir="auto">As usual, though <strong>obvious</strong>, just work on <strong>copies</strong> of your <strong>two</strong> files <strong>File<code>1</code></strong> and <strong>File<code>2</code></strong> !</p>
<p dir="auto">In order to simulate a <strong>real</strong> case, I simply <strong>split</strong> your set of members, in <strong>File<code>2</code></strong> in <strong>two</strong> parts, with some <strong>“rubbish”</strong> text, between !</p>
<p dir="auto">As regarding your <strong>list</strong> of members, in <strong>File<code>1</code></strong>, I suppose that each string <strong><code>user####</code></strong>, which must <strong>disappear</strong> from <strong>File<code>2</code></strong> :</p>
<ul>
<li>
<p dir="auto"><strong>Begins</strong> a line, or is <strong>preceded</strong> with a <strong>semicolon</strong> ( <strong><code>;</code></strong> )</p>
</li>
<li>
<p dir="auto"><strong>Ends</strong> a line or is <strong>followed</strong> with a <strong>semicolon</strong> ( <strong><code>;</code></strong> )</p>
</li>
</ul>
<p dir="auto">Note that the <strong>File<code>1</code></strong> contents must be <strong>added</strong> at the <strong>end</strong> of <strong>File<code>2</code></strong>, after a <strong>separation</strong> line, <strong>not used</strong> in <strong>File<code>2</code></strong>. I personally chose the <strong><code>###</code></strong> string but any string with, preferably, <strong>non-regex</strong> characters would be OK !</p>
<p dir="auto">So, following your example, we get the <strong>initial sample</strong> text, below :</p>
<pre><code class="language-diff">[role]
rid=2000
rdesc=Members
user=user100;user70;user4030;user10;user300;user33;user9;

bla
bla blah

blaaah
bla bla blah

[role]
rid=1000
rdesc=Members
user=user2;user35;user290;user30;user158;user3;user893;user10;
bla blah

blaaah

###

user3
user9;user10;user2
user30
</code></pre>
<p dir="auto">Now, we run the following <strong>regex</strong> S/R :</p>
<p dir="auto">SEARCH <strong><code>(user\d+);(?=(?s).*###.*(^|;)\1(;|\R))|(?s)###.+</code></strong></p>
<p dir="auto">REPLACE <strong><code>Leave EMPTY</code></strong></p>
<p dir="auto">And we get the <strong>expected</strong> text, below ( the <strong><code>user####</code></strong> members, present in <strong>File<code>1</code></strong> are <strong>removed</strong> from <strong>File<code>2</code></strong> as well as <strong>all</strong> the <strong>File<code>1</code></strong> contents, which have been <strong>temporarily</strong> added ) Voilà !</p>
<pre><code class="language-diff">[role]
rid=2000
rdesc=Members
user=user100;user70;user4030;user300;user33;

bla
bla blah

blaaah
bla bla blah

[role]
rid=1000
rdesc=Members
user=user35;user290;user158;user893;
bla blah

blaaah
</code></pre>
<p dir="auto">Best Regards,</p>
<p dir="auto">guy038</p>
<p dir="auto"><strong>P.S.</strong> :</p>
<p dir="auto">Note that, in <strong>File<code>2</code></strong>, the <strong>last</strong> <strong><code>user10</code></strong> member is also <strong>removed</strong>, because it was <strong>already</strong> present, <strong>twice</strong>, in <strong>File<code>2</code></strong> !</p>
]]></description><link>https://community.notepad-plus-plus.org/post/33941</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/33941</guid><dc:creator><![CDATA[guy038]]></dc:creator><pubDate>Sat, 04 Aug 2018 20:18:52 GMT</pubDate></item></channel></rss>