search in shell

The script should check the entire create table definition upto ; and list out the test suite names which does not primary index in the definition.

Example:
main directory which has subdirectries also:

/home/surya

File name : abc.text

create table data (pi int, col1 char(1), col2 char(5), col3 int)
primary index (pi);

1.Check for Create table upto ;
2.omit primary index if found and display the file names and the directory it was found

Thanks,
surya

Why don't you just try grep?

If the problem is still complex, be specific with your requirement.

i have tried with grep like this didn't help my requirement
Requirement:

check for the table definition which does not have "primary index" as in example in the whole directories which has subdirectories also.

create table will be addressed as CT or CREATE TABLE or ct or create table

create table data (pi int, col1 char(1), col2 char(5), col3 int)
primary index (pi);

it should list whole create table whole definition upto ; even if it is next lines of the file,

display the definition along with the directory and filename

HI,

Why dont you use the grep -v option?, the grep -v option will ignore the "primary index" in your case.

i want create table definition also:

List out the file names which has �create table upto ; � even if it's in next line.
List out directory found and the file name which satisfied the above criteria:

Example:

Ab.text:

create table data (pi int, col1 char(1), col2 char(5), col3 int) primary index (
pi)

;

Hi,

For example you are in the home directory and searching for the files which consists of the text "create..." , irrelevent to the location of files (even if it is in child directory),

grep -R "create"|grep -v "unique index"

Use the above command from the parent directory,
this will list the files which contains the text "create" from current + child directories. Then in the o/p ignore the files which contains the text "unique index".

grep -R ---> recrusive grep (searches the string in the child directries too)
grep-v ----> Ignores the given string from the o/p.

actually it has to search the whole create table definition if found

starting from CREATE TABLE ....... to ;

Example:

if the contains :

CREATE TABLE Table1, FALLBACK
(col1 CHAR(4),
col2 INTEGER,
col3 INTEGER,
col4 INTEGER,
col5 INTEGER,
col6 INTEGER)
UNIQUE PRIMARY INDEX (col2)
;

CREATE INDEX (col3) ON Table1 ;

INS Table1 VALUES ( 'AAA',1,1,1,1,1 ) ;
INS Table1 VALUES ( 'BBB',2,2,2,2,2 ) ;
INS Table1 VALUES ( 'CCC',3,3,3,3,3 ) ;
INS Table1 VALUES ( 'DDD',4,4,4,4,4 ) ;

CREATE VIEW View1 as SELECT * from Table1 ;

the search command should return :

CREATE TABLE Table1, FALLBACK
(col1 CHAR(4),
col2 INTEGER,
col3 INTEGER,
col4 INTEGER,
col5 INTEGER,
col6 INTEGER)
UNIQUE PRIMARY INDEX (col2)
;
i think grep will search only single,the search has to traverse the entire definition upto ; and display ...

sorry for the trouble.....,will be glad if you help me