lundi 20 mars 2017

sed delete lines between two patterns, without the second pattern

my input file looks like this:

[1234]
text 
text
text

[3456]
text 
text
text

[7458]
text 
text
text

I want to delete all lines between the patterns, including FROM_HERE and excluding TO_HERE.

sed '/FROM_HERE/,/TO_HERE/{//p;d;}'

Now i have:

sed '/^\['"3456"'\]/,/^\[.*\]/{//p;d;}'

but this command does not delete the line FROM_HERE too.

How can i achieve this? Thanks.

Aucun commentaire:

Enregistrer un commentaire