i need to find a string starting with create and ends with semi-colon ; . if so insert the below statement before create statement
rename table emp to emp_rename;
and after semi-colon ; need to insert the below statements
insert into emp sel * from emp_rename;
drop table emp_rename;
o/p will be like this:
rename table emp to emp_rename;
create table emp
( empno integer,
empname char(50))
primary index(empno);
insert into emp sel * from emp_rename;
drop table emp_rename;
first string is always create and last char is ; in my file
can some one help on this
have tried awk
awk '/^create/;$/ ddlfile.txt
but after getting the pattern, not sure how to write the new statement above and below create statements.