Article by Vishal Thakur
This post is a living post - I'll keep adding to it as I come across more useful regexs'.
IP address:
This should give you all strings that look like IP addresses - will also get you strings that are not valid IP addresses:
\b\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\b
This one is longer but should give you valid IP addresses:
\b(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9]?[0-9])\.
(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9]?[0-9])\.
(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9]?[0-9])\.
(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9]?[0-9])\b
Grep:
This will get you everything 'after' the word 'http' in ALL the lines in a file.
grep -o 'http:.*' > c2i-all
Comments
Post a Comment