i have an array call ignore. it is set up
ignore[0]=34th56
ignore[1]=re45ty
ignore[2]=rt45yu
.
.
ignore[n]=rthg34
n is a variable. I have another variable that i read from a different file. It is $2 and it is working the way i expect. array ignore read and print correct values.
in the below if statement (2nd if statement where i use array ignore), i need to do following, if "$2" == 34th56 || "$2" == re45ty || .... "$2" == rt45yu .i dont want to do a while or for loop, because it is printing lots of junk that i dont want. Can any one help me with this please?
#! /usr/bin/ksh
# $2 is a variable and it is working the way i expect
# array ignore read and print correct values and it is working fine too
# in the if statement, i need to do following, if "$2" == ignore[0] || "$2" == ignore[1] || .... "$2" == ignore[n]
# { print " "
# foundTermEvent = 0;
# }
# else {
# print;
# print " FOUND A BADTC " }
file=../data/globallyIgnoredTc.dat
set -A ignore `grep -v "#" ${file} | tr '[A-Z]' '[a-z]' `
if (foundTermEvent == 1)
{
if ( "$2" in ignore )
{
print " DIDNT FIND BAD TC "
# { print $1 }
# { print $2 }
foundTermEvent = 0;
}
else
{
print;
print " FOUND A BADTC "
# { print $1 }
{ print $2 }
print " ########################## "
}
}