Having a sql file (package), I want to remove all the comments (/*text*/
) from the file with UNIX (sed
).
This is what I have tried:
sed 's/[:blank:]*-~.*[\n]*.*~-$//' file.txt
It seems that the line feed character does not work that way. Any suggestions? It should remove from line 3 to 8. And line 15.
SQL File:
CREATE OR REPLACE PACKAGE BODY MYSCHEMA.MYPACKAGE
AS
/***************************************************************************
Author : myname
Date 10/2019
Overview : This is the main control procedure
Major Modifications (initial, when, ver, irfs, description):
***************************************************************************/
PROCEDURE MYPROCEDURE (p_error IN OUT NUMBER,
p_return_code IN OUT NUMBER,
p_error_message IN OUT VARCHAR2)
AS
v_infomsgid NUMBER;
BEGIN
/*This is my comment about this process*/
MY_SQL_CODE_HERE;
END;
END MYPACKAGE;
The desired output is this:
CREATE OR REPLACE PACKAGE BODY MYSCHEMA.MYPACKAGE
AS
PROCEDURE MYPROCEDURE (p_error IN OUT NUMBER,
p_return_code IN OUT NUMBER,
p_error_message IN OUT VARCHAR2)
AS
v_infomsgid NUMBER;
BEGIN
MY_SQL_CODE_HERE;
END;
END MYPACKAGE;
Thanks!