Community
    • Login

    A little help please

    Scheduled Pinned Locked Moved General Discussion
    6 Posts 3 Posters 348 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.
    • Kathy MedinaK
      Kathy Medina
      last edited by

      Im using notepad to try something
      i have a lot of trext like this:

      <host endtime=“1610639975”><address addr=“179.8.138.90” addrtype=“ipv4”/><ports><port protocol=“tcp” portid=“37777”><state state=“open” reason=“syn-ack” reason_ttl=“60”/></port></ports></host>
      <host endtime=“1610639976”><address addr=“201.217.248.199” addrtype=“ipv4”/><ports><port protocol=“tcp” portid=“37777”><state state=“open” reason=“syn-ack” reason_ttl=“52”/></port></ports></host>
      <host endtime=“1610639977”><address addr=“190.82.98.90” addrtype=“ipv4”/><ports><port protocol=“tcp” portid=“37777”><state state=“open” reason=“syn-ack” reason_ttl=“56”/></port></ports></host>
      <host endtime=“1610639977”><address addr=“201.217.253.232” addrtype=“ipv4”/><ports><port protocol=“tcp” portid=“37777”><state state=“open” reason=“syn-ack” reason_ttl=“54”/></port></ports></host>

      and i need to delete everything and just leave the ips
      like this:
      179.8.138.90
      201.217.248.199
      190.82.98.90
      201.217.253.232

      im a newbi on this, and im trying to do this with the “replace” option.

      thanks friends!

      Alan KilbornA astrosofistaA 2 Replies Last reply Reply Quote 0
      • Alan KilbornA
        Alan Kilborn @Kathy Medina
        last edited by

        @Kathy-Medina

        I’m sure there are “tighter” ways to match IP addresses, but I’d probably do this with your data:

        Open the Mark dialog by pressing Ctrl+m

        find: \d{1,3}(?:\.\d{1,3}){3}
        search mode: regular expression

        Press the Mark all button.

        This should mark in a color (usually reddish) your IPs.

        Press the Copy Marked Text button and then do a paste somewhere else. There’s your data.

        1 Reply Last reply Reply Quote 4
        • astrosofistaA
          astrosofista @Kathy Medina
          last edited by

          Hi @Kathy-Medina

          I assume that the curly quotes in the data you posted are actually straight quotes. If that is the case, then the following regex will do the job:

          Search: (?-s).*?addr="([\d.]+)".*?|.*
          Replace: $1
          

          Put the caret at the very beginning of the document, select just the Regular Expressions mode and click the Replace All button.

          Take care and have fun!

          1 Reply Last reply Reply Quote 4
          • Kathy MedinaK
            Kathy Medina
            last edited by

            @astrosofista said in A little help please:

            $1

            great!
            thanks a lot

            the replace method works for me.
            About the Alans Method, a can t find the option “copy marked text”

            astrosofistaA 1 Reply Last reply Reply Quote 1
            • astrosofistaA
              astrosofista @Kathy Medina
              last edited by

              @Kathy-Medina said in A little help please:

              copy marked text

              You’re welcome. To take advantage of the “copy marked text” option you need v7.9.1.

              Alan KilbornA 1 Reply Last reply Reply Quote 1
              • Alan KilbornA
                Alan Kilborn @astrosofista
                last edited by

                @astrosofista said in A little help please:

                To take advantage of the “copy marked text” option you need v7.9.1.

                …or later!

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