0

In my code/text file whatever is between /* and */ is commented - I have to remove this commented code from my text/code file

$ cat codefile.txt
/*~BB~*************************************
asdasd
asdas
asdasd
asdas
asdad
*************************************/

/*
aasdas
asdsa
asdsa
*/

But when I use:

sed -i '/^\/\*/,/*\*\//d'

it only deletes lines where I only have one star after/before the slash - the second block I mean.

How can I get rid of the first one ?

closed as off-topic by RomanPerekhrest, thrig, Archemar, garethTheRed, jimmij Dec 26 '17 at 22:21

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Questions describing a problem that can't be reproduced and seemingly went away on its own (or went away when a typo was fixed) are off-topic as they are unlikely to help future readers." – RomanPerekhrest, thrig, Archemar, garethTheRed, jimmij
If this question can be reworded to fit the rules in the help center, please edit the question.

  • 1
    can't reproduce, works fine (on sed (GNU sed) 4.2.2) – RomanPerekhrest Dec 26 '17 at 18:16
1

Use below command it worked fine for me I tested by inserting other contents in file too. it only deletes the lines which is between /* and */


sed '/\/\*/,/\*\//d' filename

Not the answer you're looking for? Browse other questions tagged or ask your own question.