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

  • From: "Radoulov, Dimitre" <cichomitiko@xxxxxxxxx>
  • To: aluoor@xxxxxxxxx
  • Date: Thu, 10 Feb 2011 15:42:04 +0100

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

--
//www.freelists.org/webpage/oracle-l


Other related posts: