lundi 28 mars 2016

How can I use sed to add search pattern in multi-line string after?

I have this text in file:

<TAG-ONE> multi
 line
 text
<TAG-TWO> multi
 line
 text

I want get it:

<TAG-ONE> multi
 line
 text
</TAG-ONE>
<TAG-TWO> multi
 line
 text
</TAG-TWO>

Please help me end this pattern:

sed '/^<[A-Z-]*>/,/^</{s/^<\([A-Z-]*\)>/&\n\1/}'

Aucun commentaire:

Enregistrer un commentaire