|
|||||||
| Forums | Search Forums | Register | Forum Rules | Man Pages | Albums | FAQ | Members | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
|
|
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
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 Last edited by rakeshforum; 09-15-2008 at 04:45 AM.. |
| Sponsored Links | ||
|
|
#2
|
|||
|
|||
|
please reply me soon
|
| Sponsored Links | ||
|
|
#3
|
|||
|
|||
|
First tell us what you have tried.
So that we can suggest you improvement.. |
|
#5
|
|||
|
|||
|
Plz try this one..
Hi Rakesh I didn't work in Oracle but I could suggest this way to try:
![]() 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 |
| Sponsored Links | |
|
|
#6
|
|||
|
|||
|
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 Last edited by Niroj; 09-15-2008 at 07:06 AM.. |
| Sponsored Links | ||
|
![]() |
| Thread Tools | Search this Thread |
| Display Modes | |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| awk pattern matching and shell issue. | deboprio | Shell Programming and Scripting | 7 | 12-28-2011 03:35 AM |
| Pattern matching in shell script | Deei | Shell Programming and Scripting | 3 | 06-14-2010 05:05 AM |
| shell script pattern matching | mirfan | Shell Programming and Scripting | 3 | 09-14-2009 02:22 AM |
| Pattern matching in shell scripting. | Irishboy24 | Shell Programming and Scripting | 6 | 08-28-2009 09:45 AM |
| Pattern matching in a shell script? | paulobrad | Shell Programming and Scripting | 1 | 07-14-2008 08:56 AM |
|
|