Search and filter IP address results



  • I have the following set of lines:

    3.0.0.0-4.2.144.255-50331648-67277055-US-United States
    4.2.145.64-4.2.170.63-67277120-67283519-US-United States
    4.2.170.128-4.17.135.31-67283584-68257567-US-United States
    4.17.135.64-4.17.142.255-68257600-68259583-US-United States
    4.17.143.16-4.18.32.71-68259600-68296775-US-United States
    4.18.32.80-4.18.40.135-68296784-68298887-US-United States
    4.18.40.144-4.18.65.255-68298896-68305407-US-United States
    4.18.68.0-4.18.100.31-68305920-68314143-US-United States
    ...
    

    How to get results:

    3.0.0.0-4.2.144.255
    4.2.145.64-4.2.170.63
    4.2.170.128-4.17.135.31
    4.17.135.64-4.17.142.255
    4.17.143.16-4.18.32.71
    4.18.32.80-4.18.40.135
    4.18.40.144-4.18.65.255
    4.18.68.0-4.18.100.31
    ...
    

    I tried using search and markup IPs. This has selected exactly what I need. However I do not know how to copy or cut the highlighted characters. Does this seem to help me?



  • @Sarah-Duong

    So I’ll give you another (perhaps the last) freebie, but you’ve been here before with some search-and-replace questions, and you should be demonstrating some learning by now. You should show what you’ve already tried and maybe some thoughts on what went wrong with it. Otherwise it seems that you are just sponging off of the help here whenever you need to do a replacement, and not even attempting anything yourself.

    Maybe try:

    Find what box: (?-s)-\d{4,}.+
    Replace with box: Make sure this box is EMPTY !
    Search mode radiobutton: Regular expression



  • @Alan-Kilborn Thanks. This helped me.



  • @Alan-Kilborn

    It’s too late for OP and your solution worked fine, but just for the sake of variety and taking into account that the sample data she provided are quite regular, a non-regex solution is feasible and easy to deliver (it only requires the BetterMultiSelection plugin installed and enabled):

    Giphy

    Have Fun!



  • @astrosofista

    Yea, these days I guess Better Multiselection is the new hot thing! :-)



  • @astrosofista Why not provide a guide to help others. For example, after searching for instructions, I only found one answer here, but it did not support me at all. Is it too selfish?



  • @Fake-Trum said in Search and filter IP address results:

    Why not provide a guide to help others.

    Hi @Fake-Trum and All

    Sure. Actually it’s a quite easy method. First off, open Preferences -> Edition, and enable the Multi-Editing Settings. It also requires the BetterMultiSelection plugin activated, which you can download and install via Plugins Admin.

    Then, do as the movie shows:

    1. Put the caret at the very beginning of the word list, that is, at the left of the number 3 (on the first line).

    2. Press Shift + Alt and move the caret from the top line until the bottom of the list with the arrow down - you will get a giant caret blinking along 8 lines with no characters selected.

    3. Press End. Eight carets will be blinking at the end of each line.

    4. Press Shift + Control + Arrow Left to backward select the words to delete or Shift + Arrow Left to move character by character.

    5. Once all the unwanted text is selected — nine steps as the .gif shows —, press Delete.

    A similar outcome, not shown in the movie, can be obtained moving forward, from left to right:

    3b) Instead of pressing End, just move to the right by words by means of Control + Arrow Right until the dash that follows the 255 number on the first line.

    4b) Press Shift + End to select the text to delete and remove it.

    That’s all. Lots of useful things can be done with the multi-selection and BMS plugin combo, for example, align columns, padding, right aligning columns, and curiously enough flip columns, that is, reverse their order.

    Have fun!



  • @astrosofista

    Nice writeup.

    One minor quibble:

    Preferences -> Edition

    should be

    Preferences -> Editing

    Lots of useful things can be done with the multi-selection and BMS plugin combo, for example, align columns, padding, right aligning columns, and curiously enough flip columns, that is, reverse their order.

    Well, now you’re going to have to give instructions for ALL of those operations. :-)



  • @Alan-Kilborn said in Search and filter IP address results:

    Preferences -> Editing

    Good catch, thank you.

    Concerning the further instructions plea, I know you were kidding, but that’s what I get for not knowing how to shut up my big mouth in time, ha ha.

    We’ll see, if there’s interest, it’s a simple thing to accomplish.


Log in to reply