Community
    • Login

    how to extract?

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    7 Posts 4 Posters 346 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.
    • zarate peteryZ
      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
        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
          zarate petery @AliMirzaei5778
          last edited by

          @alimirzaei5778
          could be done with regular expressions
          ?

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