Thanks for all the answers. Much more than I needed, of course, but very helpful
I didn't have time to answer fast enough and I was suddenly flooded with answers.
The most direct answer to what I was trying to achieve was from rknichols. Now I know exactly that I can pass bash positional parameters to awk in the context of strings with regex. I've just tested it and it works really well.
But the other answers were also helpful too. For instance keefaz made it much simpler and practical so I didn't need to pass any positional parameters to awk.
Indeed, I was interested in ipv4. It so happened that I disabled ipv6, so the ipv6 addresses don't show up. On the other hand, if they did show up, I know that I'd need to match the exact word 'inet' and not 'inet6'. That's easier to do, of course.
Other posts using awk with srch and gensub I'd need more time to understand, I haven't studied awk enough, but I'm planning to
Somebody also used grep with perl regex, but I think he edited his post, not sure why. I haven't been able to read all the posts until now. I guess the point was to match the word 'inet6' and 'inet' and then show the next string or something, i.e the IP. Not very familiar with perl regex, to be honest, but I know they solve thorny problems.