delete comments

Delete everything comes in between /* & */.

Current File:

create or replace procedure test421
is
begin
/*
---sasasas/*dsdsds
*/
dbms_output.put_line('SAURABH');
END;

To be File:

create or replace procedure test421
is
begin
dbms_output.put_line('SAURABH');
END;

Try...

sed '/\/\*/,/\*\//d' yourfile

Not working with below scenario.

create or replace procedure test421
is
begin
/*
---sasasas/*dsdsds
/
/*sasasas
/
dbms_output.put_line('SAURABH');
END;

Try this...

sed '/^[\/\*].*/,/^[\*\/]*/d' yourfile

Thanks for reply again. It's working fine, however for below scenario, it's not.

Current:

create or replace procedure test421
is
begin
/*
---sasasas/*dsdsds
/
Testing is my passion. /*sasasas
/
dbms_output.put_line('SAURABH');
END;

Expected

create or replace procedure test421
is
begin
Testing is my passion.
dbms_output.put_line('SAURABH');
END;

Try this:

sed -e 's~/\*[^$]*\*/~~' -e  '/\/\*/,/\*\//d' file

Below code is not working. output is following.

create or replace procedure test421
is
begin
dbms_output.put_line('SAURABH');--trtertre;
END;

However expected out put is.
create or replace procedure test421
is
begin
sass
dbms_output.put_line('SAURABH');
END;

You have just given the ouput.
Where is the input?
Without it I cannot tell why it is not working.

Pls find the input.

create or replace procedure test421
is
begin
sass/*asasas
---sasasas/dsdsds;
sasas
/
dbms_output.put_line('SAURABH');--trtertre;
dbms_output.put_line('baisakhiya');--trtertre;
END;

I hope this will help you...

tr "\n" "@" < yourfile | sed '/\/\*/,/\*\// s:/\*.*\*/::g' | tr "@" "\n"
sed -e 's~\(/\*\)~\n\1~;' yourfile | sed -e '/\/\*/,/\*\//d;'