I am passing to sed for replacement text that seems to have some characters that it does not like.
The text comes from git log graph
and is something like:
ID- desc author
ID- desc author
I get unescaped newline inside substitute pattern
How can I escape everything before piping to sed?
Example:
COMMIT=$(git log my_branch...origin/master --pretty=format:'%h %an')
FINAL=$(cat msg.txt | sed -E "s/--PLACEHOLDER--/$COMMIT/)
$COMMIT
contain? – Kusalananda Jun 11 '18 at 14:25$COMMIT
is that you get on your system with your Git repository. – Kusalananda Jun 11 '18 at 15:42od -t a
there is no weird character there. I do see anl
in the end of each line but even if I pipe totr -d '\n'
I still get the same error – Jim Jun 11 '18 at 20:47