Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- str = "21:51:05.908379 IP 69.70.85.212.bahnhof.se.ntp > 39.108.66.17.46303: NTPv2, Reserved, length 440
- 21:51:05.908423 IP 46.101.254.124.ntp > 39.108.66.17.50901: NTPv2, Reserved, length 440
- 21:51:05.908423 IP 46.101.254.124.ntp > 39.108.66.17.50901: NTPv2, Reserved, length 440
- 21:51:05.908425 IP 46.101.254.124.ntp > 39.108.66.17.50901: NTPv2, Reserved, length 440
- 21:51:05.908436 IP 46.101.254.124.ntp > 39.108.66.17.50901: NTPv2, Reserved, length 440
- 21:51:05.908438 IP 46.101.254.124.ntp > 39.108.66.17.50901: NTPv2, Reserved, length 440
- ";
- regex=/^[^I]*IP ([^>]*)>.*$/;
- arr = [];
- str.scan(regex).each{|m|arr.push m }
- arr = arr.uniq
- puts arr
- puts arr.length
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement