Not very familiar with complex usages of sed
, but I have this requirement now. I have a file 1.txt with contents in the following pattern:
sree@amby01:/home/sree : cat 1.txt
SSL
this first line
#comment line
second line
# third comment
# line nline
#ApiText
lkjfl
# my line
your line
sree@amby01:/home/sree :
Now, I want to remove the commented lines between the block SSL....#ApiText
, but the line #ApiText
should not be removed.
The output should look like this:
SSL
this first line
second line
#ApiText
Its a bash shell. I know how to remove commented lines alone, but not how to remove commented lines except when the comment is following by a certain text. I can use only sed
.
sed
"... Um... why?