title: shell script to check ping packet loss & avg latency on AIX
body: <p>I'm trying to create script which will ping to remote server and displays only 
  1)  % packet loss
  2) average round trip latency in ms</p>
  
  <p>for packet loss i created line </p>
  
  <pre><code>`ping -c 3 -s 14 x.x.x.x|grep packet|awk '{print $7}'|cut -d'%' -f1`
  </code></pre>
  
  <p>which only gives packet loss, </p>
  
  <p>my problem starts when ip is not reachable output of line changes 
  and hence i'm not able to capture both</p>
  
  <p>for reference i'm showing output of both scenarios </p>
  
  <pre><code>   `/pefmephbir &gt;ping -c 3 -s 14 10.9.50.225`
    PING 10.9.50.225 (10.9.50.225): 14 data bytes
  
    --- 10.9.50.225 ping statistics ---
    **3 packets transmitted, 0 packets received, 100% packet loss**
  
  
    `/pefmephbir &gt;ping -c 3 -s 14 10.9.50.220`
    PING 10.9.50.220 (10.9.50.220): 14 data bytes
    22 bytes from 10.9.50.220: icmp_seq=0 ttl=63 time=0 ms
    22 bytes from 10.9.50.220: icmp_seq=1 ttl=63 time=0 ms
    22 bytes from 10.9.50.220: icmp_seq=2 ttl=63 time=0 ms
  
    --- 10.9.50.220 ping statistics ---
    **3 packets transmitted, 3 packets received, 0% packet loss
    round-trip min/avg/max = 0/0/0 ms**
  </code></pre>
  
  <p>hope someone with expertise in scripting can help me out</p>
  
  <p>TIA</p>