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:
someline
2015/01/11
I can't make a pattern that extracts dates, because 2015/01/11
can be just Sunday
or Yesterday
or almost anything else. read
can also be anything. I tried this with BSD sed
:
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 <
and !
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'
Can sed
not do this? If not, how do I do it with any other tool/language?
someline \n file first read on
? – pfnuesel Jan 24 '16 at 17:53someline \n 2015/01/11
(with the example above) – DisplayName Jan 24 '16 at 17:54