I am trying to use regular expression to identify ONLY the commands that hasn't the word "tablespace" within it. a command starts with "create table" and ends with ; (semicolon)
example file:
create table first tablespace ;
create table second
(
BBL_CUSTOMER_NAME VARCHAR2(32),
a tablespace af
);
create table third
(
BBL_CUSTOMER_NAME VARCHAR2(32),
);
create table
forth
(
BBL_CUSTOMER_NAME VARCHAR2(32) );
I think that grep will not cross newlines, so that you would need to place your commands each on a single line. There is a note in my man grep page about using perl regular expressions, but that it is undocumented. The awk and perl scripts can make use of settable record boundaries.
Here's a perl quickie:
#!/bin/sh
# @(#) s1 Demonstrate perl quickie for unmatched string across lines.
FILE=${1-data1}
perl -wn -e 'BEGIN{$/=";"} print if not /tablespace/' $FILE
exit 0
And running this on your sample contained in file data1:
unfortunately the final solution will be used in windows environment ,
I am not planning to use Perl because it will need installations in all PCs.
the nuances of regular expression is almost the same in all other languages.
So the convenient solution will be vbscript.