• Login
Community
  • Login

how to extract?

Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
7 Posts 4 Posters 366 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.
  • Z
    zarate petery
    last edited by May 31, 2022, 3:55 PM

    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 = []

    N 1 Reply Last reply May 31, 2022, 5:48 PM Reply Quote 0
    • A
      AliMirzaei5778
      last edited by May 31, 2022, 4:15 PM

      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.

      Z 1 Reply Last reply May 31, 2022, 5:26 PM Reply Quote 0
      • Z
        zarate petery @AliMirzaei5778
        last edited by May 31, 2022, 5:26 PM

        @alimirzaei5778
        could be done with regular expressions
        ?

        A 1 Reply Last reply May 31, 2022, 5:33 PM Reply Quote 0
        • A
          Alan Kilborn @zarate petery
          last edited by May 31, 2022, 5:33 PM

          @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
          • N
            Neil Schipper @zarate petery
            last edited by May 31, 2022, 5:48 PM

            @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?

            Z 1 Reply Last reply May 31, 2022, 6:21 PM Reply Quote 0
            • Z
              zarate petery @Neil Schipper
              last edited by May 31, 2022, 6:21 PM

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

              N 1 Reply Last reply May 31, 2022, 6:56 PM Reply Quote 0
              • N
                Neil Schipper @zarate petery
                last edited by May 31, 2022, 6:56 PM

                @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
                5 out of 7
                • First post
                  5/7
                  Last post
                The Community of users of the Notepad++ text editor.
                Powered by NodeBB | Contributors