Grep IP addresses from a file.
- July 18th, 2008
- Posted in Documentation
- Write comment
egrep ‘[[:digit:]]{1,3}’\.'[[:digit:]]{1,3}’\.'[[:digit:]]{1,3}’\.'[[:digit:]]{1,3}’ filename
egrep “[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}” filename
Note: this will not exclude invalid IP addresses such as 500.500.500.500, but it is something to start with.
If doing a copy an paste, the single quotes need to be typed manually until I figure out how enter them correctly.
No comments yet.