Re: print only tnsping errors (example no listener) not successful resolving

From: Radoulov, Dimitre <cichomitiko_at_gmail.com>
Date: Thu, 10 Feb 2011 15:42:04 +0100
Message-ID: <4D53F93C.3020106_at_gmail.com>



On 10/02/2011 14:53, Sven Aluoor wrote:
> Hi folks
>
> I made the command:
>
> for i in `grep 'SID' /opt/webimr/params | awk '{ print $3 } '`; do
> tnsping $i ; done
>
> it gives me huge output (because over 600 instances), but I am only
> interested in errors (not successful resolved). Howto filter all
> errors out?
>

I could suggest something like this:

while read; do

   case $REPLY in

     *SID* ) set -- $REPLY ;;
         * ) continue      ;;

   esac
   tnsping "$3" > /dev/null 2>&1 ||

      printf 'tnsping failed for %s\n' "$3" done < /opt/webimr/params

If you post a small part of the/opt/webimr/params content, the script could become nicer :)

Regards
Dimitre

--
http://www.freelists.org/webpage/oracle-l
Received on Thu Feb 10 2011 - 08:42:04 CST

Original text of this message