I was wondering how to extract only certain data from the output of a shell command in Applescript. I want to be able to only pass the IP address into the variable from a "ping -o" command like this:
do shell script "ping -o " & blockedURL
-- Set the IP to blockedIP --
set blockedIP to ..
but I receive this:
"PING example.com (192.0.43.10): 56 data bytes 64 bytes from 192.0.43.10: icmp_seq=0 ttl=239 time=101.587 ms
--- example.com ping statistics --- 1 packets transmitted, 1 packets received, 0.0% packet loss round-trip min/avg/max/stddev = 101.587/101.587/101.587/0.000 ms"
When I execute the ping command I receive a lot of data I dont need. Is there any way of being able to only recall the (192.0.43.10)
?