<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic script question in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/script-question/m-p/2808831#M83744</link>
    <description>Hey all,&lt;BR /&gt;&lt;BR /&gt;I have this script here that I ran every so often to ping my connections. How do I use the grep statement and have it grep for 100% packetloss and then display just the packet loss info. to the screen. I hope I'm making clear what I'm asking for here. Points will definitely be assigned. &lt;BR /&gt;&lt;BR /&gt;host=$(hostname)&lt;BR /&gt;case $host in&lt;BR /&gt;   "hostname")&lt;BR /&gt;        echo "PINGING FROM $host"&lt;BR /&gt;        /etc/ping hostname -n 3&lt;BR /&gt;        /etc/ping 192.168.22.36 -n 3&lt;BR /&gt;        /etc/ping 192.168.24.36 -n 3&lt;BR /&gt;        /etc/ping 192.168.22.34 -n 3&lt;BR /&gt;        /etc/ping 192.168.24.34 -n 3&lt;BR /&gt;        echo "PINGING TO POPS"&lt;BR /&gt;        /etc/ping 192.159.81.20 -n 3&lt;BR /&gt;        ;;&lt;BR /&gt;        * ) echo "$host not in list"; exit 1;;&lt;BR /&gt;esac&lt;BR /&gt;exit&lt;BR /&gt;&lt;BR /&gt;</description>
    <pubDate>Wed, 18 Sep 2002 15:12:18 GMT</pubDate>
    <dc:creator>Ragni Singh</dc:creator>
    <dc:date>2002-09-18T15:12:18Z</dc:date>
    <item>
      <title>script question</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-question/m-p/2808831#M83744</link>
      <description>Hey all,&lt;BR /&gt;&lt;BR /&gt;I have this script here that I ran every so often to ping my connections. How do I use the grep statement and have it grep for 100% packetloss and then display just the packet loss info. to the screen. I hope I'm making clear what I'm asking for here. Points will definitely be assigned. &lt;BR /&gt;&lt;BR /&gt;host=$(hostname)&lt;BR /&gt;case $host in&lt;BR /&gt;   "hostname")&lt;BR /&gt;        echo "PINGING FROM $host"&lt;BR /&gt;        /etc/ping hostname -n 3&lt;BR /&gt;        /etc/ping 192.168.22.36 -n 3&lt;BR /&gt;        /etc/ping 192.168.24.36 -n 3&lt;BR /&gt;        /etc/ping 192.168.22.34 -n 3&lt;BR /&gt;        /etc/ping 192.168.24.34 -n 3&lt;BR /&gt;        echo "PINGING TO POPS"&lt;BR /&gt;        /etc/ping 192.159.81.20 -n 3&lt;BR /&gt;        ;;&lt;BR /&gt;        * ) echo "$host not in list"; exit 1;;&lt;BR /&gt;esac&lt;BR /&gt;exit&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Wed, 18 Sep 2002 15:12:18 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-question/m-p/2808831#M83744</guid>
      <dc:creator>Ragni Singh</dc:creator>
      <dc:date>2002-09-18T15:12:18Z</dc:date>
    </item>
    <item>
      <title>Re: script question</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-question/m-p/2808832#M83745</link>
      <description>I have an answer in a previous thread that may help you.&lt;BR /&gt;You may have to adapt for the %&lt;BR /&gt;Jean-Luc&lt;BR /&gt;&lt;A href="http://forums.itrc.hp.com/cm/QuestionAnswer/1,,0x64a193e260b0d611abdb0090277a778c,00.html" target="_blank"&gt;http://forums.itrc.hp.com/cm/QuestionAnswer/1,,0x64a193e260b0d611abdb0090277a778c,00.html&lt;/A&gt;&lt;BR /&gt;</description>
      <pubDate>Wed, 18 Sep 2002 15:15:22 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-question/m-p/2808832#M83745</guid>
      <dc:creator>Jean-Luc Oudart</dc:creator>
      <dc:date>2002-09-18T15:15:22Z</dc:date>
    </item>
    <item>
      <title>Re: script question</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-question/m-p/2808833#M83746</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;I know you are looking for an answer with grep, but you can do it without grep'ing the result.  You can just test the result of the ping in an if statement and go from there.  Here is a thread with a similar script:&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://forums.itrc.hp.com/cm/QuestionAnswer/1,,0xfbf35f260cafd4118fef0090279cd0f9,00.html" target="_blank"&gt;http://forums.itrc.hp.com/cm/QuestionAnswer/1,,0xfbf35f260cafd4118fef0090279cd0f9,00.html&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;JP&lt;BR /&gt;</description>
      <pubDate>Wed, 18 Sep 2002 15:16:00 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-question/m-p/2808833#M83746</guid>
      <dc:creator>John Poff</dc:creator>
      <dc:date>2002-09-18T15:16:00Z</dc:date>
    </item>
    <item>
      <title>Re: script question</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-question/m-p/2808834#M83747</link>
      <description>host=$(hostname) &lt;BR /&gt;case $host in &lt;BR /&gt;"hostname") &lt;BR /&gt;echo "PINGING FROM $host" &lt;BR /&gt;(/etc/ping hostname -n 3 &lt;BR /&gt;/etc/ping 192.168.22.36 -n 3 &lt;BR /&gt;/etc/ping 192.168.24.36 -n 3 &lt;BR /&gt;/etc/ping 192.168.22.34 -n 3 &lt;BR /&gt;/etc/ping 192.168.24.34 -n 3 &lt;BR /&gt;echo "PINGING TO POPS" &lt;BR /&gt;/etc/ping 192.159.81.20 -n 3) | grep "100% packet loss" &lt;BR /&gt;;; &lt;BR /&gt;* ) echo "$host not in list"; exit 1;; &lt;BR /&gt;esac &lt;BR /&gt;exit &lt;BR /&gt;</description>
      <pubDate>Wed, 18 Sep 2002 15:19:55 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-question/m-p/2808834#M83747</guid>
      <dc:creator>Vincent Fleming</dc:creator>
      <dc:date>2002-09-18T15:19:55Z</dc:date>
    </item>
    <item>
      <title>Re: script question</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-question/m-p/2808835#M83748</link>
      <description>Here's a version to actually display the packet loss info:&lt;BR /&gt;&lt;BR /&gt;#/usr/bin/sh&lt;BR /&gt;#for addr in hostname 192.168.22.36 192.168.24.36 192.168.22.34 192.168.24.34&lt;BR /&gt;do&lt;BR /&gt;        stat=`/usr/sbin/ping $addr -n 3 | grep "100% packet loss"`&lt;BR /&gt;        if [ $? -eq 0 ]&lt;BR /&gt;        then&lt;BR /&gt;                echo $addr: $stat&lt;BR /&gt;        fi&lt;BR /&gt;&lt;BR /&gt;        # Alternate method since I've read that $? may be set by ping on 10.20&lt;BR /&gt;        # to 0 regardless of whether it succeeds or fails&lt;BR /&gt;        if [ X"$stat" != X ]&lt;BR /&gt;        then&lt;BR /&gt;                echo $addr: $stat&lt;BR /&gt;        fi&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;Darrell</description>
      <pubDate>Wed, 18 Sep 2002 17:53:42 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-question/m-p/2808835#M83748</guid>
      <dc:creator>Darrell Allen</dc:creator>
      <dc:date>2002-09-18T17:53:42Z</dc:date>
    </item>
  </channel>
</rss>

