How do I make a shell command that finds IPv6 addresses in its stdin?
One option is to use:
grep -Po '(?<![[:alnum:]]|[[:alnum:]]:)(?:(?:[a-f0-9]{1,4}:){7}[a-f0-9]{1,4}|(?:[a-f0-9]{1,4}:){1,6}:(?:[a-f0-9]{1,4}:){0,5}[a-f0-9]{1,4})(?![[:alnum:]]:?)'
This RE is based on ideas from "Regular expression that matches valid IPv6 addresses", but this is not quite accurate. I could use an even uglier regular expression, but is there a better way, some command that I don't know about?