This question already has an answer here:
If I have a text file with this content:
someline <!--\ file first read on 2015/01/11
And I want to delete
<!--\ and everything until what comes after "on", how do I do it? The expected output would be this with the example above:
I can't make a pattern that extracts dates, because
2015/01/11 can be just
Yesterday or almost anything else.
read can also be anything. I tried this with BSD
sed 's/<!--\ file first .* on//g'
But when I run this command, I get this error:
sed: 1: "s/<!--\ file f ...": unterminated substitute pattern
So I tried backslash escaping
! but I got the same "unterminated substitute pattern" error. I tried to install GNU sed and do the same thing except
\n, I also tried
gsed 's/<!--:a;N;$!ba;s/\n/file first .* on//g' but I got:
gsed: -e expression #1, char 22: unknown option to `s'
sed not do this? If not, how do I do it with any other tool/language?