How to filter IPv4 and IPv6 addresses?

echo "1.1.1.1" | awk '/[0-9]*.[0-9]*.[0-9]*.[0-9]*/ {print $1}' How can I filter IPv4 addresses in a script, and how can I filter IPv6 addresses. I mean more precisely then this so the oneliner should only output VALID IPv4 addresses or another script to output only VALID IPv6 addr. In different languages? like: awk, perl? ty! Answers: … Read more