Advertisement
Guest User

Untitled

a guest
Apr 18th, 2019
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.65 KB | None | 0 0
  1. str = "21:51:05.908379 IP 69.70.85.212.bahnhof.se.ntp > 39.108.66.17.46303: NTPv2, Reserved, length 440
  2. 21:51:05.908423 IP 46.101.254.124.ntp > 39.108.66.17.50901: NTPv2, Reserved, length 440
  3. 21:51:05.908423 IP 46.101.254.124.ntp > 39.108.66.17.50901: NTPv2, Reserved, length 440
  4. 21:51:05.908425 IP 46.101.254.124.ntp > 39.108.66.17.50901: NTPv2, Reserved, length 440
  5. 21:51:05.908436 IP 46.101.254.124.ntp > 39.108.66.17.50901: NTPv2, Reserved, length 440
  6. 21:51:05.908438 IP 46.101.254.124.ntp > 39.108.66.17.50901: NTPv2, Reserved, length 440
  7. ";
  8.  
  9. regex=/^[^I]*IP ([^>]*)>.*$/;
  10.  
  11. arr = [];
  12.  
  13. str.scan(regex).each{|m|arr.push m }
  14.  
  15. arr = arr.uniq
  16.  
  17. puts arr
  18. puts arr.length
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement