salawank

regex_ip.py

Aug 5th, 2013
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.18 KB | None | 0 0
  1. #!/usr/bin/python -tt
  2.  
  3. import re
  4.  
  5. f = open('data.txt', 'r')
  6.  
  7. ip_raw = re.findall(r'(\b\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\b)', f.read())
  8.  
  9. ip = '\n'.join(set(ip_raw))
  10. print ip
Add Comment
Please, Sign In to add comment