Keeping the 2 first digits from an IP?
-
I have this range of IP’s:
19.20.21.22
19.21.22.23
20.150.172.28
20.192.238.24
21.193.128.44
22.193.12.6I want to keep only the 2 first digits and delete duplicates
Results:
19
20
21 -
Find:
(?-s)^(\d+)\..+
Replace:${1}
Search mode: Regular expressionFollow that with this action:

-
@alan-kilborn ,
Thanks Alan, another NPP capability I wasn’t aware of…but that just means my needs haven’t been expansive enough to seek it out, but I’m getting there. :) -
@alan-kilborn, look like it’s not finding anything…

-
@roger-st-onge Still having issue, not able to make it work

-
It’s because you misrepresented your data.
What you showed originally started in column 1 (well, as far as anyone could tell).
The^in the expression means start-of-line must occur there.
Experiment with removing that character from the find expression.
Also a good idea to read up on regular expression searching; see this site’s FAQ page. -
Thanks for helping a Newbie :) With your help I was able to achive my task.
Solution to clean up AWS Public IP list
https://ip-ranges.amazonaws.com/ip-ranges.jsonRemoved all alphabet: \b(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(.(?1)){3}\b

Then
Find: (?-s)^(\d+)..+
Replace: ${1}
Search mode: Regular expressionThen

Final Results for first set of IP’s in Microsoft Azure Publip IP List

-
Note this is for Azure Public IP List,
not for AWS
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