What if I had a shitton of ancient shtml files that all, somewhere near the top of the body, contained a line like “BEGIN MAIN CONTENT”?
What if I wanted to wipe everything above that and substitute some include script? I’d use sed, right?
If I figure this out before you do, I’ll post my command line here.
This variant …
sed -i -e '/<html>/,/<title/s/[.^M\n]*/pfeh/' testy.shtml
From the line that contains <html> to the line that contains <title, do something. Something, in this case is adding the word “pfeh” to the start of each line. Not quite it.
I think the secret lies in using /i and /a to insert or append lines.