• Login
Community
  • Login

Replace with text from a list line by line

Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
6 Posts 3 Posters 409 Views
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • T
    Tomas Hipp
    last edited by May 5, 2021, 11:43 AM

    Hello All.
    I have 2 txt files. One with text where I need to replace specific words (userID) with actual IDs which are in another document (each in new line). So now it looks like:
    Document 1:
    texttexttext<userID>texttexttext
    texttexttext<userID>texttexttext
    texttexttext<userID>texttexttext

    Document 2:
    asvddsr3132ds
    osdc7haisnjci
    292jdjdaoiscn

    And need final document:
    texttexttext<asvddsr3132ds>texttexttext
    texttexttext<osdc7haisnjci>texttexttext
    texttexttext<292jdjdaoiscn>texttexttext

    As you can see, new userID need to be replaced with new line from document2.
    Can somebody help me please ?

    1 Reply Last reply Reply Quote 0
    • E
      Ekopalypse
      last edited by May 5, 2021, 11:56 AM

      @Tomas-Hipp

      From the given explanation I would select the column and copy the new userids, then I select the userID column and replace it.
      Column selection is the key here.
      But I suppose in reality it is not so simple.

      1 Reply Last reply Reply Quote 0
      • T
        Tomas Hipp
        last edited by May 5, 2021, 12:02 PM

        @Ekopalypse said in Replace with text from a list line by line:

        n selection is the key here.
        But I suppose in reality it is not so simple.

        Nope, it is not really as excel. It look more like:
        blablablatexttexte. another bla bla bla <userID> something else, bla bla bla text <userID> something bla bla etc <userID> and so on…
        But positive is that what need to be changed is always between <>.

        1 Reply Last reply Reply Quote 0
        • E
          Ekopalypse
          last edited by Ekopalypse May 5, 2021, 12:08 PM May 5, 2021, 12:08 PM

          @Tomas-Hipp

          Nope, it is not really as excel …

          and this is crucial to know.
          There is no function like read line from doc2 and replace field in doc1.
          If the data layout is not known, one cannot provide a reasonable solution.
          If the data is sensitive, obfuscate it without destroying the actual layout and post it.

          A 1 Reply Last reply May 5, 2021, 12:25 PM Reply Quote 1
          • A
            Alan Kilborn @Ekopalypse
            last edited by May 5, 2021, 12:25 PM

            @Ekopalypse said in Replace with text from a list line by line:

            If the data is sensitive

            Looks sensitive…looks like passwords.

            In general, replacing “from a list” is a tough task for Notepad++

            E 1 Reply Last reply May 5, 2021, 12:31 PM Reply Quote 2
            • E
              Ekopalypse @Alan Kilborn
              last edited by May 5, 2021, 12:31 PM

              @Alan-Kilborn

              Right, I remember guy038 did something like that with regex, but then it’s even more crucial to know the exact layout and a pythonscript might be possible, but I hesitate to think about it or create something without knowing what to do.

              1 Reply Last reply Reply Quote 2
              5 out of 6
              • First post
                5/6
                Last post
              The Community of users of the Notepad++ text editor.
              Powered by NodeBB | Contributors