Script to search a string

Hi all

Am having records as below
file1
----
abc
12a
a2b

am trying to write a script to identify the character is present in the specified array

validchar=a b c d e 1
rec=`cat file1`
am getting the records in loop

for i in $rec
do
if [ $i in $validchar-------how to check here in array

please help

if it is present no issues if the string is not there in validchar i need to print out

check this one

 
#!/bin/sh 
for var in ` cat input_file.txt | sed 's/./&\n/g'`
do
if [ $var == "a" -o $var == "b" ] ; then
        echo " do something "
else
        echo $var                   
fi
done
 

"a" -o $var == "b"

i want to change dynamically the array strings(validchar)

Could explain how the dynamic variable are generated ? so that we do the test againt it.
Do you look for getopt , check

man getopt

for more details .

Am having records as below
file1
----
abc
12a
a2b

file2
-----
a
b
c
d
e

am trying to write a script to identify the character is present in the specified array

validchar=`cat $file2`
rec=`cat file1`
am getting the records in loop

for i in $rec
do
if [ $i in $validchar-------how to check here in array

please help

if it is present no issues if the string is not there in validchar i need to print out