I want to be able to handle any type of content stored into the bash variable
${CONTENT}
, to be used as sed
replacement text into another content, no matter if there are quotation marks, single quotes or other special characters that an HTML file with CSS can have, without needing to create temporary files.
CONTENT=$(cat "${HTML_FILE}")
HTML=$(cat "parent_file.html" | tr -d '\n' | sed -E "s/(]*>).*()/\1\n${CONTENT}\n\2/")
But this will error out with an error like:
sed: -e expression #1, char XXX: unterminated `s' command
Is what I'm asking for even possible?
Asked by Harry McKenzie
(137 rep)
Apr 11, 2024, 01:18 PM
Last activity: Apr 11, 2024, 04:18 PM
Last activity: Apr 11, 2024, 04:18 PM