shell pattern matching

Hello Members

I am facing a problem regarding pattern matching.please guide me to solve the issue.My requirement is like:
There is table in oracle database, in that table contain columns ,inside the column so many files are there. my requirement is that to search a pattern for example: pattern is "123456" . Write a shell script that search the pattern one by one file(i.e it takes the file one by one from table) . if inside a file pattern doesn't exist then it will redirect this pattern and file name to some other file.

Please give me some idea so that i can move ahead, any help will be highly appreciated.

Thanks
Rakesh

please reply me soon

First tell us what you have tried.

So that we can suggest you improvement..

Bump up questions is not allowed, please read our rules.

Hi Rakesh I didn't work in Oracle but I could suggest this way to try::slight_smile:
Please check it before running. I didn't check this program..

chk_file ()
{
echo "Enter the destination direcory nm: [Give the full path]"
read dest

for f in `cat $1`
do
if [ -f $f ] && [ ` grep "(pattern like:1234)" $f | wc -w ` != 1 ]; then

 mv $f $dest

fi
done

}

# login to unix machine(check the instance)

echo "`dbaccess db_nm << EOFSQL 2>> /dev/null/
SELECT col_nm FROM Tab_nm;
EOFSQL`" > file_nms.tmp

chk_file file_nms.tmp

Plz try this...(FOR ORACLE)
chk_file ()
{
echo "Enter the destination direcory nm: [Give the full path]"
read dest

for f in $1
do
if [ -f $f ] && [ ` grep "(pattern like:1234)" $f | wc -w ` != 1 ]; then

mv $f $dest

fi
done

}

file_nm=`sqlplus -S usernm/passwd@host_string <<EOF
set head off feedback off echo off pages 0
SELECT col_nm FROM tab_nm`
/
EOF

chk_file file_nm