What i need to end up with, is one line for each of the subnets. Those are in the last 8 columns. Like this
10.16.64.0/24,ABC,Prod,10.16.64.0
10.16.64.0/24,ABC,Prod,10.16.65.0
10.16.64.0/24,ABC,Prod,10.16.66.0
10.16.64.0/24,ABC,Prod,10.16.67.0

Or if easier, just
ABC,Prod,10.16.64.0
ABC,Prod,10.16.65.0
ABC,Prod,10.16.66.0
ABC,Prod,10.16.67.0

This is going to be used as a lookup table to match any IP in the network with the first 3 octets in this list and return the data center and environment.

Since this is going into a vendor tool, I don’t have the luxury of using a function /script/program to return the values programmatically. I need a lookup list.

If I suppose that the fields 2 and 3 ( datacenter and environment ) begin, always, with a letter, then the following S/R, performed ONCE, only, in Regular expression mode, by clicking on the Replace All button

Then, with this second S/R, below, you should get your text as you like to !

SEARCH = (?-s)(.+?,.+?,.+?,).+\R(?=[^,\r\n]+\R)

REPLACE = $0\1

IMPORTANT :

You’ll have to perform this second S/R, MANY times, till no more occurrence can be found ! That is to say that you’ll just have to click on the Replace All button, repeatedly, at least eight times, as you may have up to 8 addresses, in your file !

So, after eight consecutive replacements, we obtain the final text below :

What about using a find and replace with a regex? (I’m not a regex expert, but this appeared to work for me. )
Simple example. (In the replace box the “Search Mode” is “Regular expression”)
Set the “Find what:” to:
^(.?,.?,.?),(.?),(.?),(.?),(.?),(.?),(.?),(.?),(.*?)$
Set the “Replace with :” to:
\1,\2\r\n\1,\3\r\n\1,\4\r\n\1,\5\r\n\1,\6\r\n\1,\7\r\n\1,\8\r\n\1,\9

Et voilà ! Well, although I practised regexes, since many years, I, always, surprised by their incredible power !!

Notes :

If the original line is only 10.16.64.0/24,ABC,Prod,, without any address, after, the S/R just rewrites that line

In the search regex, the 8 parts (.*?) are groups from 2 to 9, each containing a possible address, which must be rewritten, in replacement

These 8 groups, followed by a comma, are embedded in an optional non-capturing group (?:(.*?),)? ( the group may be present [1] or absent [0] )

At the beginning, the part (.*?,.*?,.*?,) looks for the first three fields : network, datacenter and environment, followed by a comma

In replacement, the syntax (?#\1\#\r\n) is called a conditional replacement. It means that IF the group #exists, then it rewrites the group 1, followed by the group #, followed by the Windows EOL characters \r\n

At the beginning, the part \1(?2\2)\r\n writes, first, the group 1. Then it writes the group 2, ONLY IF it exists ( the first IPV4 address ), and, finally rewrites the Windows EOL characters \r\n

Remarks :

Contrary to my previous post, with this new S/R, there is no condition, any more, about the contents of fields 2 and 3 ! They could be, for instance : 10.16.64.0/24,99999,00000000,… :-)

Any possible leading indentation, of a line, is just kept, by this S/R !

You can click, either, on the Replace All button AND/OR on the Replace button, for a step by step replacement :-)