• Login
Community
  • Login

Help needed please

Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
8 Posts 2 Posters 314 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.
  • F
    Francesca D'Angelo
    last edited by Sep 3, 2020, 5:25 AM

    so i have a large txt files and each string is like this
    1000000|0000|0000|abcderfjejeh|
    2000000|0000000|00|uerjrurjejjejej
    And so on…
    now i want to extract only part starting with:
    0000000|0000000|00| without the characters
    how i can do it ?
    thanks in advance.

    F 1 Reply Last reply Sep 3, 2020, 5:33 AM Reply Quote 0
    • F
      Francesca D'Angelo @Francesca D'Angelo
      last edited by Sep 3, 2020, 5:33 AM

      @Francesca-D-Angelo
      numbers and letters are just an example they aint all “0” in the original file text.
      Please help.

      1 Reply Last reply Reply Quote 0
      • T
        Terry R
        last edited by Terry R Sep 3, 2020, 5:52 AM Sep 3, 2020, 5:50 AM

        @Francesca-D-Angelo said in Help needed please:

        i want to extract only part starting with

        It’s a bit difficult as your example doesn’t give much away. But if I read it correctly you have strings of characters which are delimited by the | character. And you want the first 3 sets including that delimiter. So if I’m correct the following regex (regular expression) should work in a Replace function.
        Find What:^([^|]+\|[^|]+\|[^|]+\|).+$
        Replace With:\1
        As this is a regex it needs the search mode set to “regular expression” and please have wrap around ticked.
        To give a bit of background the regex says:
        [^|]+\| take as many characters so long as they are NOT the |, followed by 1 |. Then we do 3 sets of these and as they are inside of the () we save these as group 1. The rest of the line is also captured but as it is not inside brackets it is not saved. Only group 1 is written back. The result should be what you need.

        If you find it does not meet your needs please come back with more info, especially examples. Real data is best, or at least good example data, rather then just the 0’s you provided.

        Terry

        F 1 Reply Last reply Sep 3, 2020, 6:19 AM Reply Quote 3
        • F
          Francesca D'Angelo @Terry R
          last edited by Sep 3, 2020, 6:19 AM

          @Terry-R you did it !!! it worked you saved me days of work i was extracting 1 by 1 ;*
          now last thing if it is possible
          now i have
          "1|0000000|000|00000
          "2|0000000|00000|00000
          and so on…

          i want remove the "1 , "2, "3, and so on…

          thats last thing! thank you a lot

          F 1 Reply Last reply Sep 3, 2020, 6:45 AM Reply Quote 0
          • F
            Francesca D'Angelo @Francesca D'Angelo
            last edited by Sep 3, 2020, 6:45 AM

            @Francesca-D-Angelo

            @Terry-R said in Help needed please:

            @Francesca-D-Angelo said in Help needed please:

            i want to extract only part starting with

            It’s a bit difficult as your example doesn’t give much away. But if I read it correctly you have strings of characters which are delimited by the | character. And you want the first 3 sets including that delimiter. So if I’m correct the following regex (regular expression) should work in a Replace function.
            Find What:^([^|]+\|[^|]+\|[^|]+\|).+$
            Replace With:\1
            As this is a regex it needs the search mode set to “regular expression” and please have wrap around ticked.
            To give a bit of background the regex says:
            [^|]+\| take as many characters so long as they are NOT the |, followed by 1 |. Then we do 3 sets of these and as they are inside of the () we save these as group 1. The rest of the line is also captured but as it is not inside brackets it is not saved. Only group 1 is written back. The result should be what you need.

            If you find it does not meet your needs please come back with more info, especially examples. Real data is best, or at least good example data, rather then just the 0’s you provided.

            Terry

            now i need remove the
            "1|
            "2|
            "3|
            and so on…
            from the results
            "1|00000000|0000|000
            clean result should be:
            00000000|0000|000

            hope you have understood and sorry for double post.

            1 Reply Last reply Reply Quote 0
            • T
              Terry R
              last edited by Terry R Sep 3, 2020, 7:02 AM Sep 3, 2020, 7:01 AM

              @Francesca-D-Angelo said in Help needed please:

              now i need remove the
              "1|
              "2|
              "3|

              How about trying (in the Replace function)
              Find What:^"[^|]+\|
              Replace With: nothing in this field, make sure it is empty

              This time it’s looking for the " character at the start of a line followed by as many characters as possible ending in the first delimiter |.

              A proviso here, the quote you typed may NOT be the same as finally presented because the window you type the post in is processed before it appears in the forum. The quote character is one of the more common characters changed by the system. So if it doesn’t work replace my quote with the quote you actually have in your data.

              Preferably for any further posts use the </> button which you see immediately above the window in which you type. Enter the text, select the text and then use this button which encapsulates the text in the black box. This will prevent characters from being possibly altered, which is especially important for any examples you provide.

              If you need any further help you MUST use this black box to provide the examples otherwise I won’t be helping.

              Terry

              PS it’s also nice to receive "upvotes. which you see below each post on the right side. It starts at 0. Use the arrow keys either side for upvote or downvote.

              F 1 Reply Last reply Sep 3, 2020, 8:24 AM Reply Quote 3
              • F
                Francesca D'Angelo @Terry R
                last edited by Sep 3, 2020, 8:24 AM

                thanks a lot this worked too.
                I promise this will be last request:

                now if in some case i have:

                1|0000|00000|000
                2|0000|0000000|0000 
                10|
                100|
                and so on
                

                so without the " at the beginning, what command i should use for remove them?

                1 Reply Last reply Reply Quote 2
                • T
                  Terry R
                  last edited by Sep 3, 2020, 8:56 AM

                  @Francesca-D-Angelo said in Help needed please:

                  without the " at the beginning

                  First off, thanks for reading and doing as requested. It makes it so much easier if the examples can be trusted.

                  Try my previous solution and just remove the ". That should be sufficient although I do note some of the examples don’t have 3 sets. Your data seems a bit arbitrary as generally delimited data will always have the same number of fields

                  Terry

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