regex - Sed remove from match until match -


i want remove parts of file starting match (including first match) , until second match (excluding second match). file looks this, another question:

3. line 3 4. line 4 ## screenshots ## 1. line 1 2. line 2 3. line 3 4. line 4 ## changelog ## 3. line 3 4. line 4 

from answers of the other question have taken sed command outputs ## screenshots ## until 4. line 4, before ## changelog ##. however, remove section file.

to clarify, know next section start ##, ## foobar ## know :)

i have tried replace print commands delete commands so

sed -e '/## screensh/,/##/{/scree/{d;n};/##/{q};d}' file 

but did not work because stops output after second match, ## changelog ## in case (because of quit command). have tried use regex character class match # character sed -n '/## screenshots ##[^#]*/p' prints ## screenshots ##.

something this:

sed '/## screenshot/,/##/{/screenshot/d;/##/!d}' 

that's - delete between 2 matches, including first not including last. if know section ends '## changelog ##' becomes just

sed '/## screenshot/,/##/{/## changelog/!d}' 

Comments

Popular posts from this blog

get url and add instance to a model with prefilled foreign key :django admin -

android - Keyboard hides my half of edit-text and button below it even in scroll view -

css - Make div keyboard-scrollable in jQuery Mobile? -