While @nhahtdh's answer is the correct one for your original question, this solution is the answer to your comments:
sed '
/<!-- PAGE TAG -->/,/<!-- PAGE TAG -->/ {
1 {
s/^.*$/Replace Data/
b
}
d
}
'
You can read it like so:
/<!-- PAGE TAG -->/,/<!-- PAGE TAG -->/
-> for the lines between these regexes
1 {
-> for the first matching line
s/^.*$/Replace Data/
-> search for anything and replace with Replace Data
b
-> branch to end (behaves like break in this instance)
d
-> otherwise, delete the line
You can make any series of sed commands into one-liners with gnu sed by adding semicolons after each command (but it's not recommended if you want to be able to read it later on):
sed '/<!-- PAGE TAG -->/,/<!-- PAGE TAG -->/ { 1 { s/^.*$/Replace Data/; b; }; d; };'
Just as a side note, you should really try to be as specific as possible in your posting. "replaced/removed" means "replaced OR removed". If you want it replaced, just say replaced. That helps both those of us trying to answer your question and future users who might be experiencing the same issue.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…