I want to grep ipv6 addresses in below format like 2a01:1388:120:720::1000 and 2b00:1188:210:9::2005
i use this to grep ipv4’s from a file
1.egrep '[[:digit:]]{1,3}.[[:digit:]]{1,3}.[[:digit:]]{1,3}.[[:digit:]]{1,3}' file
2.grep -E -o '(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?).(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?).(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?).(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)' file
Omit the -o if you want to see the entire line that matched.
Is there any similar regex for ipv6?