• Login
Community
  • Login

multiple txt to one new txt

Scheduled Pinned Locked Moved General Discussion
24 Posts 3 Posters 3.3k 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.
  • G
    guy038
    last edited by guy038 Jan 21, 2020, 10:16 PM Jan 21, 2020, 10:10 PM

    Hi, @pinuzzu99 and All,

    Ok ! So, assuming your short example, below :

    .: data :.
    =================================
    asda pamfhdjosa.mardedyly@ydefgo.com:cloggr4trr
    =================================
     
    ubba:/my-wallets.zip                               379912     2019-08-07T02:52:11+02:00
    .: data :.
    =================================
    asda cartgrtgrg@gfgbil.com:1r5yyr78115
    Pry Statinf: Kree
    =================================
     
    ubba:/crypto.zip                                   380547     2019-08-07T02:50:07+02:00
    .: data :.
    =================================
    asda jatrhtrh@grthil.com:mrthhrhmm17
    Pry Statinf: Kree
    =================================
     
    ubba:/wallets.zip                                  379807     2019-08-07T02:58:33+02:00
    .: data :.
    =================================
    asda lathmhjm@hhhjail.com:p456456inha
    Pry Statinf: Kree
    

    The following regex S/R :

    SEARCH (?-s)^(?!\h*[\w.\x20]+@).*\R?

    REPLACE Leave EMPTY

    gives this output text :

    asda pamfhdjosa.mardedyly@ydefgo.com:cloggr4trr
    asda cartgrtgrg@gfgbil.com:1r5yyr78115
    asda jatrhtrh@grthil.com:mrthhrhmm17
    asda lathmhjm@hhhjail.com:p456456inha
    

    Are you expecting this result ?

    I simply suppose that the non-null part of an e-mail address, located before the @ char, may contain :

    • Any word character

    • A dot symbol

    • A space character

    Best Regards,

    guy038

    1 Reply Last reply Reply Quote 1
    • P
      pinuzzu99
      last edited by Jan 22, 2020, 8:11 AM

      thank you very much. excellent result. I’d still like if you could also delete the first part of the text in front of the email from:
      asda address@mail.com : mrthhrhmm17
      until you get:
      address@mail.com : mrthhrhmm17
      this of course for all the email addresses listed …

      1 Reply Last reply Reply Quote 0
      • G
        guy038
        last edited by guy038 Jan 22, 2020, 9:10 AM Jan 22, 2020, 9:09 AM

        Hi, @pinuzzu99 and All,

        No problem ! If we assume that there are no space char in e-mail addressses ( generally the case ! ) and further on, in current scanned line, we just need to add an alternative which, implicitly, looks for lines with an e-mail address and deletes from beginning of current line till a non-null range of space characters. Thus, the following regex S/R :

        SEARCH (?-s)^(?!\h*[\w.\x20]+@).*\R?|^.*?\x20+

        REPLACE Leave EMPTY

        And you’ll obtain your expected result :

        pamfhdjosa.mardedyly@ydefgo.com:cloggr4trr
        cartgrtgrg@gfgbil.com:1r5yyr78115
        jatrhtrh@grthil.com:mrthhrhmm17
        lathmhjm@hhhjail.com:p456456inha
        

        Best Regards,

        guy038

        1 Reply Last reply Reply Quote 1
        • P
          pinuzzu99
          last edited by Jan 22, 2020, 1:25 PM

          oh yes! finally what i wanted!
          thank you very much, dear guy038.

          1 Reply Last reply Reply Quote 0
          • P
            pinuzzu99
            last edited by Jan 22, 2020, 4:35 PM

            another little help:
            i have another txt with text like this:

            ladgdfg_jfdggs@yertynno.com.vn:1234556:1654473467:53687091200
            jegfa@nkcore.com:jeryr55673:1757810123:53687091200
            ghyfm36@rocgfhmmail.com:mintgg18509:11767409268:53687091200
            v7cifgthhy@yasbco.com.tw:512454215:380488:53687091200
            

            i need have like this:

            code_text
            ladgdfg_jfdggs@yertynno.com.vn:1234556
            jegfa@nkcore.com:jeryr55673
            ghyfm36@rocgfhmmail.com:mintgg18509
            v7cifgthhy@yasbco.com.tw:512454215
            

            i want delete all :number:number

            A 1 Reply Last reply Jan 22, 2020, 4:47 PM Reply Quote -1
            • A
              Alan Kilborn @pinuzzu99
              last edited by Jan 22, 2020, 4:47 PM

              @pinuzzu99

              What have you tried?
              What did you get?
              What didn’t work about it?

              1 Reply Last reply Reply Quote 1
              • P
                pinuzzu99
                last edited by Jan 22, 2020, 5:06 PM

                which regex is needed to eliminate :number:number at the end of each line

                1 Reply Last reply Reply Quote -1
                • G
                  guy038
                  last edited by guy038 Jan 23, 2020, 2:24 AM Jan 23, 2020, 1:07 AM

                  Hi, @pinuzzu99 and All,

                  Nice ! I even succeded to merge your two kinds of text, by adding a third alternative in the search regex !


                  So, starting with the input text, below, where the e-mail adresses may be :

                  • Preceded with any chars ( asda, 12345 …), followed with, at least, one space char OR beginning the line

                  • Followed with, at least, one field, determined by a colon separator char

                  bla bla blah
                  bla bla blah
                  bla bla blah
                  asda ladgdfg_jfdggs@yertynno.com.vn:1234556:1654473467:53687091200
                  bla bla blah
                  bla bla blah
                  jegfa@nkcore.com:jeryr55673:1757810123:53687091200
                  bla bla blah
                  bla bla blah
                  12345      ghyfm36@rocgfhmmail.com:mintgg18509:0000000000000:1111111111:55555555555555:777777777777777777:99999999999
                  bla bla blah
                  bla bla blah
                  bla bla blah
                  asda           v7cifgthhy@yasbco.com.tw:512454215:380488:53687091200
                  

                  Use the following regex S/R :

                  • SEARCH (?-s)^(?!\h*[\w.\x20]+@).*\R?|^.*?\x20+|.+?:.+?\K:.+

                  • REPLACE Leave EMPTY

                  • Of course, the Regular expression search mode is selected and the Wrap around option is ticked

                  • You must use the Replace All button, exclusively ( Not the Replace button ! )

                  We get the following output text :

                  ladgdfg_jfdggs@yertynno.com.vn:1234556
                  jegfa@nkcore.com:jeryr55673
                  ghyfm36@rocgfhmmail.com:mintgg18509
                  v7cifgthhy@yasbco.com.tw:512454215
                  

                  Notes :

                  This regular expression is composed of 3 alternatives :

                  • The first part (?-s)^(?!\h*[\w.\x20]+@).*\R?, which have been explained previouly. If deletes any entire line, which does not contain a @ char, after a non-null range of words chars and possible dot and/or space chars

                  • The second part ^.*?\x20+ which deletes all text between beginning of line and a non-null range of space characters, if that line contains an e-mail address, further on

                  • The third part .+?:.+?\K:.+ deletes, after the e-mail adress, from the second : char found till the last standard char of the current scanned line

                  • Note, in this last part, the use of the lazy quantifier +? to identify all standard chars between the first and the second : chars and the \K syntax before the second : char, which resets the overall search and just grabs all the remaining chars of current line, from the second :, included


                  Remark :

                  I strongly advice you to learn the regular expresions world ! Of course, you’ll have to study for 1/2 months, but it’s really worth it ;-)). To begin with, consult this FAQ :

                  https://community.notepad-plus-plus.org/topic/15765/faq-desk-where-to-find-regex-documentation

                  Best Regards,

                  guy038

                  1 Reply Last reply Reply Quote 1
                  • P
                    pinuzzu99
                    last edited by Jan 23, 2020, 8:12 AM

                    ohhhhh very great! many thanks for your help! very very thanks.
                    and you’re right when you say you have to study. and usually I do. but in the case of np ++ using little, it did not occur to me to search and learn reg ex expressions. but I will take your suggestion into account.

                    for my question: this is ANOTHER txt, then different. but anyway you code work great, my intent was that! very very many thanks for your help!
                    Regards

                    1 Reply Last reply Reply Quote 0
                    • G
                      guy038
                      last edited by Jan 23, 2020, 11:27 AM

                      Hi, @pinuzzu99,

                      Ah, OK ! So, if we consider that there were 2 separate tasks and starting with your exact input text, below :

                      ladgdfg_jfdggs@yertynno.com.vn:1234556:1654473467:53687091200
                      jegfa@nkcore.com:jeryr55673:1757810123:53687091200
                      ghyfm36@rocgfhmmail.com:mintgg18509:11767409268:53687091200
                      v7cifgthhy@yasbco.com.tw:512454215:380488:53687091200
                      

                      The following regex S/R :

                      • SEARCH (?-s)^.+?:.+?\K:.+

                      • REPLACE Leave EMPTY

                      • Click on the Replace All button, exclusively

                      should leave you with your expected result :

                      ladgdfg_jfdggs@yertynno.com.vn:1234556
                      jegfa@nkcore.com:jeryr55673
                      ghyfm36@rocgfhmmail.com:mintgg18509
                      v7cifgthhy@yasbco.com.tw:512454215
                      

                      Cheers,

                      guy038

                      1 Reply Last reply Reply Quote 0
                      • P
                        pinuzzu99
                        last edited by Jan 23, 2020, 2:29 PM

                        thanks you so much, again! cheers

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