Content extract of a file using awk

Hi Everyone,

I have a file with the below content:

File1.txt

###
###==> the below table was created for testing1 purpose;
###
create table 123
(
field1 date,
field2 char(10)
primary key(field1)
);

###
###==> the below table was created for testing2 purpose;
###
create table abc
(
fielda1 date,
fielda2 char(10)
);

Question:
I would like to print only the 'create table' statements like below:

Sample Output:

create table 123
(
field1 date,
field2 char(10)
primary key(field1)
);
create table abc
(
fielda1 date,
fielda2 char(10)
);

any hints would be much appreciated.

Thanks.

RaviShankar

egrep -v '^#|^$' file1.txt

yeah i can use "grep -v" but i just want to know if this can be done thru' awk?
I want to learn more in awk.

learning awk is very good, but also try to learn when to use what. if you can do something using grep, cut etc. why invoke awk and lose on performance? this would make it clear

this is one place for learning awk

Hi , i agree with you.

Anyway the awk statement is :

awk ' $0 !~ /^#|^$/' file
awk ' !/^#|^$/' file