Extract IP address from string using grep

From ben.goodacre.name/tech

Jump to: navigation, search

-o option tells grep to only print the parts that match the grep

$ host yahoo.com | grep -Eo '([0-9]{1,3}\.){3}[0-9]{1,3}'
209.191.122.70
67.195.160.76
69.147.125.65
72.30.2.43
98.137.149.56

See Also

Regular Expressions

Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox