I am attempting to replace multiple lines using sed on a Linux system
Here is my file
<!-- PAGE TAG -->
DATA1
DATA2
DATA3
DATA4
DATA5
DATA6
<div id="DATA"></div>
DATA8
DATA9
<!-- PAGE TAG -->
The attempts I have made and failed!
sed -n '1h;1!H;${;g;s/<!-- PAGE TAG -->.*<!-- PAGE TAG -->//g;p;}'
sed -n '1!N; s/<!-- PAGE TAG -->.*<!-- PAGE TAG -->// p'
sed -i 's|<!--[^>]*-->[^+]+<!--[^>]*-->||g'
sed -i 's|///<!-- PAGE TA -->/,///<!-- PAGE TA -->||g'
Everything in between <!-- PAGE TAG -->
should be replaced.
This question is similar sed multiline replace
See Question&Answers more detail:os