Community
    • Login

    Replace with text from a list line by line

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    6 Posts 3 Posters 862 Views 1 Watching
    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.
    • Tomas HippT Offline
      Tomas Hipp
      last edited by

      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
      • EkopalypseE Offline
        Ekopalypse
        last edited by

        @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
        • Tomas HippT Offline
          Tomas Hipp
          last edited by

          @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
          • EkopalypseE Offline
            Ekopalypse
            last edited by Ekopalypse

            @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.

            Alan KilbornA 1 Reply Last reply Reply Quote 1
            • Alan KilbornA Offline
              Alan Kilborn @Ekopalypse
              last edited by

              @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++

              EkopalypseE 1 Reply Last reply Reply Quote 2
              • EkopalypseE Offline
                Ekopalypse @Alan Kilborn
                last edited by

                @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

                Hello! It looks like you're interested in this conversation, but you don't have an account yet.

                Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

                With your input, this post could be even better 💗

                Register Login
                • First post
                  Last post
                The Community of users of the Notepad++ text editor.
                Powered by NodeBB | Contributors