I am new to the world of sed
/awk
and regex in general and have been studying their usage, but have been floundering trying to meet my need:
I have an htm
page that has a single line notice that needs to be updated with user inputted text (via shell script) between two comments acting as tags, for example:
<!--BeginNoticeMSG-->NOTICE: This is a notice<!--EndNoticeMSG-->
The user inputted text (stored in a variable, let's call it $NEWNOTICE
) would then need to replace what's between the tags, so effectively:
<!--BeginNoticeMSG-->$NEWNOTICE<!--EndNoticeMSG-->
Which would get inserted into the htm
file as (for example):
<!--BeginNoticeMSG-->This is a test notice<!--EndNoticeMSG-->
How can I identify and replace the text between the tags properly?
include
, if possible. Apache does allow that:<!--#include virtual="path/name/noticefile" -->