Community
    • Login

    how to extract?

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    7 Posts 4 Posters 733 Views 2 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.
    • zarate peteryZ Offline
      zarate petery
      last edited by

      Friends I need your help, how can I select only the lines that have only PACKS_2?

      areaCode = 343 | PHONE = 4270 | Tipo_idx = 4 | DOC = 12313SA | ID2 = 1066 | PACKS_1 = [40|JOURNAL] | PACKS_2 = []
      areaCode = 343 | PHONE = 42410 | Tipo_idx = 4 | DOC = 12313ZAS | ID2 = 10 | PACKS_2 = []
      ID = 1836854 | areaCode = 341 | PHONE = 4973 | PACKS_2 = []
      areaCode = 23 | PHONE = 466 | Tipo_idx = 1 | DOC = 2705 | ID2 = 12105 | PACKS_1 = [40|ClásiCS | PACKS_2 = []
      areaCode = 11 | PHONE = 34484555 | Tipo_idx = 4 | DOC = 31184 | PACKS_2 = []
      ID = 7863 | areaCode = 11 | PHONE = 5387 | Tipo_idx = 4 | DOC = 92651 | PACKS_2 = []

      to

      areaCode = 343 | PHONE = 42410 | Tipo_idx = 4 | DOC = 12313ZAS | ID2 = 10 | PACKS_2 = []
      ID = 1836854 | areaCode = 341 | PHONE = 4973 | PACKS_2 = []
      areaCode = 11 | PHONE = 34484555 | Tipo_idx = 4 | DOC = 31184 | PACKS_2 = []
      ID = 7863 | areaCode = 11 | PHONE = 5387 | Tipo_idx = 4 | DOC = 92651 | PACKS_2 = []

      Neil SchipperN 1 Reply Last reply Reply Quote 0
      • AliMirzaei5778A Offline
        AliMirzaei5778
        last edited by

        follow these steps:
        1 - press ctrl + H.
        2 - press ‘mark’ botton.
        3 - in ‘find what’, type ‘packs_2’.
        4 - turn on ‘bookmark line’ and ‘normal’ in search mode.
        5 - press ‘mark all’ and then ‘close’.
        6 - press alt + s.
        7 - press ‘bookmark’ bottom.
        8 - press ‘remove unmarked lines’
        that’s all.

        zarate peteryZ 1 Reply Last reply Reply Quote 0
        • zarate peteryZ Offline
          zarate petery @AliMirzaei5778
          last edited by

          @alimirzaei5778
          could be done with regular expressions
          ?

          Alan KilbornA 1 Reply Last reply Reply Quote 0
          • Alan KilbornA Offline
            Alan Kilborn @zarate petery
            last edited by

            @zarate-petery said in how to extract?:

            could be done with regular expressions

            You didn’t specify a problem that requires regular expressions to solve…

            1 Reply Last reply Reply Quote 0
            • Neil SchipperN Offline
              Neil Schipper @zarate petery
              last edited by

              @zarate-petery said in how to extract?:

              how can I select only the lines that have only PACKS_2?

              All 6 lines of sample input contain PACKS_2 and other text. So none contain “only PACKS_2”.

              Your sample output helps, but not completely. Did you mean “lines that don’t contain PACKS_1” or “lines that don’t contain PACKS_<anything besides 2>” or what?

              zarate peteryZ 1 Reply Last reply Reply Quote 0
              • zarate peteryZ Offline
                zarate petery @Neil Schipper
                last edited by

                @neil-schipper
                lines that do not contain PACKS_1 and only the lines that contain PACKS_2 = [] remain

                Neil SchipperN 1 Reply Last reply Reply Quote 0
                • Neil SchipperN Offline
                  Neil Schipper @zarate petery
                  last edited by

                  @zarate-petery

                  As a starting point, this regex matches all complete lines that do contain PACKS_1: ^.*?PACKS_1.*?$\R

                  You can use it in a Replace All operation with Replace field completely empty; this would delete all these lines.

                  This would meet the overall need with your sample data, but possibly not all of your real world data.

                  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