grep -oP '\b(?:\d{1,3}\.){3}\d{1,3}\b' text.txt

Extract IP addresses from text