• Login
Community
  • Login

multiple txt to one new txt

Scheduled Pinned Locked Moved General Discussion
24 Posts 3 Posters 3.5k 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.
  • P
    pinuzzu99
    last edited by Jan 20, 2020, 4:28 PM

    i have a lot of txt (1200!) like this content:
    xxxx@xx.xxx :kkkkkkk:380329:53687091200

    • blablabla - 380329 bytes - 9/7/2019 7:47:16 PM

    i want copy only this part xxxx@xx.xxx :kkkkkkk for each txt and paste into only new txt like this:
    xxxx@xx.xxx :kkkkkkk
    xxxx@xx.xxx :kkkkkkk
    xxxx@xx.xxx :kkkkkkk
    xxxx@xx.xxx :kkkkkkk

    is it possible to do this??

    1 Reply Last reply Reply Quote 0
    • G
      guy038
      last edited by guy038 Jan 20, 2020, 5:43 PM Jan 20, 2020, 5:01 PM

      Hello, @pinuzzu99 and All,

      Here is a solution, which involves regular expressions !

      • First copy your input text ( Ctrl + A then Ctrl + C )

      • Open a new tab ( Ctrl + N )

      • Paste your text ( Ctrl + V )

      • Open the Replace dialog ( Ctrl + H )

      • SEARCH (?-s)^(\h*\w+@.+?:.+?):.+

      • REPLACE \1

      • Tick, preferably, the Wrap around option

      • Select the Regular expression serach mode

      • Click on the Replace All button

      Et voilà !


      Notes :

      • First, the part (?-s) means that the regex dot symbol . will match only a single standard character( Not a line-break )

      • Then the part ^ is the default zero-length assertion, matching any beginning of line location

      • The part \h*\w+@ part looks for possible horizontal blank chars \h*, followed with any non-null range of word chars \w+, followed with the literal char @

      • Then, the part .+?: finds the shortest non-null range of chars till a colon :

      • Now, the part .+? matches the shortest non-null range of chars, till …

      • The last part :.+, which represents the second : of each line, followed with all the remaining chars of current scanned line

      • As the global part \h*\w+@.+?:.+? is embedded in parentheses, it’s stored as group 1, which will be re-written as \1, only, in the replacement zone

      Best Regards,

      guy038

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

        ok i have find one way to this!
        open cmd and write: for %f in (*.txt) do type “%f” >> combined.txt

        this command join all txt content into new one txt. and this it’s ok.
        now i want purge all content.
        on my new combined.txt i want delete all content except a line that contains:
        data: xxxx@xx.xxx :kkkkkkk
        this value data:xxx… repeats itself and it’s always different.
        how to purge combined.txt ??

        1 Reply Last reply Reply Quote 0
        • G
          guy038
          last edited by guy038 Jan 20, 2020, 5:57 PM Jan 20, 2020, 5:55 PM

          Hi, @pinuzzu99 and All,

          Ah, OK, I see !

          Now, in your combined.txt file, if we consider the general case, below :

          .....
          .....
          A aaaa@aa.aaa:aaaaaaa
          .....
          .....
          B aaaa@aa.aaa:kkkkkkk
          .....
          .....
          C aaaa@aa.aaa:zzzzzzz
          .....
          .....
          D xxxx@xx.xxx:aaaaaaa
          .....
          .....
          E xxxx@xx.xxx:kkkkkkk
          .....
          .....
          F xxxx@xx.xxx:zzzzzzz
          .....
          .....
          G zzzz@zz.zzz:aaaaaaa
          .....
          .....
          H zzzz@zz.zzz:kkkkkkk
          .....
          .....
          I zzzz@zz.zzz:zzzzzzz
          .....
          .....
          
          • Firstly, which line, from A to I, do you want to keep ?

          • Secondly, do you want to delete any text, of the remaining lines, after the second colon : included ?

          Cheers,

          guy038

          1 Reply Last reply Reply Quote 1
          • P
            pinuzzu99
            last edited by Jan 21, 2020, 7:57 AM

            i want delete all text (or lines) excluding lines:
            A aaaa@aa.aaa:aaaaaaa
            B aaaa@aa.aaa:kkkkkkk
            C aaaa@aa.aaa:zzzzzzz
            D xxxx@xx.xxx :aaaaaaa
            etc

            1 Reply Last reply Reply Quote 0
            • P
              pinuzzu99
              last edited by Jan 21, 2020, 8:08 AM

              or also: how to select all line with value:
              data: aaaa@aa.aaa:aaaaaaa
              data: bbb@bb.cn :bbbbbbb
              data: ccc@cc.cns:mssgahsk
              etc
              and after paste into new txt?

              1 Reply Last reply Reply Quote 0
              • G
                guy038
                last edited by guy038 Jan 21, 2020, 9:38 AM Jan 21, 2020, 9:33 AM

                Hi, @pinuzzu99 and All,

                So, apparently, you want to keep all lines beginning with an e-mail address, don’t you ?

                In that case, here is a regex S/R to delete any line, which does not begin with an e-mail address, with possible leading blank chars :

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

                REPLACE Leave Empty

                Notes :

                • The part (?!\h*\w+@) is a negative look-ahead structure that search for the literal @ char, preceded by word chars and possible blank chars ( Space or tabulation chars ) This structure returns true and valids the overall regex only when an e-mail address cannot be found

                • In that case, the part .+ grabs, from beginning of lines ( ^ ), all standard characters, of the current line scanned

                • Finally, the part \R matches all types of line-breaks ( \r\n for Windows files, \n for Unix files and \r for Mac files )

                • These entire lines are deleted, as the replace*ent zone is empty


                Now, here is the method to select specific e-mail addresses, from the remaining lines and copy them in a new document.

                Let’s suppose that you want to search for all the occurrences of the exact address ccc@cc.cns:mssgahsk :

                • Open the Mark dialog ( Search > Mark... menu item )

                • First, tick the option Bookmark line, if necessary

                • Click on the Clear All marks button ( IMPORTANT )

                • Un-tick the Purge for each search option, if necessary

                • Select the Normal search mode ( IMPORTANT )

                • Tick the Match case option, preferably

                • Tick the Wrap around option

                • SEARCH ccc@cc.cns:mssgahsk

                • Click on the Mark All button

                • You may change the Find what : contents and repeat the last 2 points, in order to bookmark other specific addresses, as well !

                • Now, select the Search > Bookmark > Copy Bookmarked Lines menu option

                • Finally, open a new document ( Ctrl + N )

                • And paste all the bookmarked lines, in this new tab ( Ctrl + V )

                Best Regards,

                guy038

                1 Reply Last reply Reply Quote 0
                • P
                  pinuzzu99
                  last edited by Jan 21, 2020, 1:36 PM

                  first method work but it remains only one address… everything else is deleted!
                  i want keep ALL address mail and passw like xxx@xx.xxx :dddd

                  second method it relates only to a specific email address, instead I have several, all different…

                  A 1 Reply Last reply Jan 21, 2020, 1:46 PM Reply Quote 0
                  • A
                    Alan Kilborn @pinuzzu99
                    last edited by Jan 21, 2020, 1:46 PM

                    @pinuzzu99

                    Hmm. This forum doesn’t exist for someone else to do your work for you. Some hints about how a feature of Notepad++ works, yes, but really, don’t expect to say “I need this very specific thing” and expect someone to hand it to you.

                    You’re expected to try things on your own, and present your (failed) results here and then you’ll probably receive help on just that aspect.

                    But wholesale problem statement and solution provided…nope.

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

                      works well with (on reg ex):
                      find what: (?-s)^(?!\h*\w+@).
                      replace with:

                      bt some mail is of the type:
                      name.gress@mail.com
                      and the first part of the email is deleted (in this specific case the term “name”)…
                      how to leave full email address?

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

                        I have found this that serves my purpose:
                        \S+?@\S+?.\S+
                        this regex select all my address@mail.com :numberletters

                        now i would like to add part of string to delete the rest of the text in my txt…

                        1 Reply Last reply Reply Quote 0
                        • G
                          guy038
                          last edited by Jan 21, 2020, 8:56 PM

                          Hello, @pinuzzu99 and All,

                          Well, it’s just up to you ! All your previous e-mail addresses did not contain any dot before the @ char. Thus, I supposed that there were only word characters !

                          With , your last example name.gress@mail.com, of course, the regex S/R should become :

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

                          REPLACE Leave EMPTY


                          Then, you said :

                          now i would like to add part of string to delete the rest of the text in my txt

                          I’m sorry but it’s really not clear to my mind !

                          Please, give us a sample of your input text, with various e-mail adresses and show us the output text you are expecting to, from your present input example !


                          Just a hint : when replying, type your input and output text as code, using the symbol </> , as below :

                          See you later,

                          Cheers,

                          guy038

                          1 Reply Last reply Reply Quote 1
                          • P
                            pinuzzu99
                            last edited by Jan 21, 2020, 9:39 PM

                            you are very kind of you. this is little extract of my txt file

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

                            i want delete all text and line except
                            mail.address@mail.com :xxxxxxxx

                            with your string not work for me.
                            work with (?-s)^(?!\h*[\w.]+@).
                            but i have this result:

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

                            empty line between emails and also one space before any mail address.
                            I hope it helps me to complete the correct string!

                            1 Reply Last reply Reply Quote 0
                            • 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
                                          8 out of 24
                                          • First post
                                            8/24
                                            Last post
                                          The Community of users of the Notepad++ text editor.
                                          Powered by NodeBB | Contributors